<URL: http://bugs.freeciv.org/Ticket/Display.html?id=37746 >

 This adds "Upgrade_Price_Pct" effect.


 - ML

diff -Nurd -X.diff_ignore freeciv/common/effects.c freeciv/common/effects.c
--- freeciv/common/effects.c	2007-03-05 21:11:49.000000000 +0200
+++ freeciv/common/effects.c	2007-03-08 03:54:30.000000000 +0200
@@ -115,7 +115,8 @@
   "Output_Waste_By_Distance",
   "Output_Penalty_Tile",
   "Output_Inc_Tile_Celebrate",
-  "City_Unhappy_Size"
+  "City_Unhappy_Size",
+  "Upgrade_Price_Pct"
 };
 
 static bool initialized = FALSE;
diff -Nurd -X.diff_ignore freeciv/common/effects.h freeciv/common/effects.h
--- freeciv/common/effects.h	2007-03-05 21:11:49.000000000 +0200
+++ freeciv/common/effects.h	2007-03-08 03:54:24.000000000 +0200
@@ -104,6 +104,7 @@
   EFT_OUTPUT_PENALTY_TILE, /* -1 penalty to tiles producing more than this */
   EFT_OUTPUT_INC_TILE_CELEBRATE,
   EFT_CITY_UNHAPPY_SIZE, /* all citizens after this are unhappy */
+  EFT_UPGRADE_PRICE_PCT,
   EFT_LAST	/* keep this last */
 };
 
diff -Nurd -X.diff_ignore freeciv/common/unittype.c freeciv/common/unittype.c
--- freeciv/common/unittype.c	2007-03-05 21:11:49.000000000 +0200
+++ freeciv/common/unittype.c	2007-03-08 03:54:10.000000000 +0200
@@ -331,7 +331,11 @@
 		       const struct unit_type *from,
 		       const struct unit_type *to)
 {
-  return unit_buy_gold_cost(to, unit_disband_shields(from));
+  int base_cost = unit_buy_gold_cost(to, unit_disband_shields(from));
+
+  return base_cost
+    * (100 + get_player_bonus(pplayer, EFT_UPGRADE_PRICE_PCT))
+    / 100;
 }
 
 /**************************************************************************
diff -Nurd -X.diff_ignore freeciv/doc/README.effects freeciv/doc/README.effects
--- freeciv/doc/README.effects	2007-03-05 21:09:38.000000000 +0200
+++ freeciv/doc/README.effects	2007-03-08 03:54:54.000000000 +0200
@@ -287,3 +287,6 @@
 
 Output_Inc_Tile_Celebrate
     Tiles get amount extra output when city working them is celebrating.
+
+Upgrade_Price_Pct
+    Increases unit upgrade cost by amount percent.
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to