Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2004:
[Freeciv-Dev] (PR#11503) put rail_bonus values into an array
Home

[Freeciv-Dev] (PR#11503) put rail_bonus values into an array

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11503) put rail_bonus values into an array
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 13 Dec 2004 08:52:26 -0800
Reply-to: bugs@xxxxxxxxxxx

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

This patch puts rail_food_bonus, rail_shield_bonus, and rail_trade_bonus 
into an array rail_tile_bonus indexed by output type.

-jason

Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.284
diff -u -r1.284 city.c
--- common/city.c       13 Dec 2004 16:23:30 -0000      1.284
+++ common/city.c       13 Dec 2004 16:51:01 -0000
@@ -590,7 +590,7 @@
   }
 
   if (contains_special(spec_t, S_RAILROAD)) {
-    s += (s * terrain_control.rail_shield_bonus) / 100;
+    s += (s * terrain_control.rail_tile_bonus[O_SHIELD]) / 100;
   }
 
   if (pcity) {
@@ -693,7 +693,7 @@
   }
 
   if (contains_special(spec_t, S_RAILROAD)) {
-    t += (t * terrain_control.rail_trade_bonus) / 100;
+    t += (t * terrain_control.rail_tile_bonus[O_TRADE]) / 100;
   }
 
   /* Civ1 specifically documents that Railroad trade increase is before 
@@ -810,7 +810,7 @@
   }
 
   if (contains_special(tile.special, S_RAILROAD)) {
-    f += (f * terrain_control.rail_food_bonus) / 100;
+    f += (f * terrain_control.rail_tile_bonus[O_FOOD]) / 100;
   }
 
   if (pcity) {
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.75
diff -u -r1.75 packets.def
--- common/packets.def  13 Dec 2004 16:20:53 -0000      1.75
+++ common/packets.def  13 Dec 2004 16:51:02 -0000
@@ -1071,9 +1071,7 @@
 
   UINT16 fortress_defense_bonus;        /* % added to defense if fortress */
   UINT16 road_superhighway_trade_bonus;  # % added to trade if road/s-highway
-  UINT16 rail_food_bonus;               /* % added to food if railroad */
-  UINT16 rail_shield_bonus;             /* % added to shield if railroad */
-  UINT16 rail_trade_bonus;              /* % added to trade if railroad */
+  UINT16 rail_tile_bonus[O_MAX];        /* % added to output if railroad */
   UINT16 farmland_supermarket_food_bonus;# % added to food if farm/s-market
   UINT16 pollution_food_penalty;        /* % subtr. from food if polluted */
   UINT16 pollution_shield_penalty;      /* % subtr. from shield if polluted */
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.215
diff -u -r1.215 ruleset.c
--- server/ruleset.c    8 Dec 2004 16:53:53 -0000       1.215
+++ server/ruleset.c    13 Dec 2004 16:51:03 -0000
@@ -1580,12 +1580,11 @@
     secfile_lookup_int_default(file, 100, "parameters.fortress_defense_bonus");
   terrain_control.road_superhighway_trade_bonus =
     secfile_lookup_int_default(file, 50, 
"parameters.road_superhighway_trade_bonus");
-  terrain_control.rail_food_bonus =
-    secfile_lookup_int_default(file, 0, "parameters.rail_food_bonus");
-  terrain_control.rail_shield_bonus =
-    secfile_lookup_int_default(file, 50, "parameters.rail_shield_bonus");
-  terrain_control.rail_trade_bonus =
-    secfile_lookup_int_default(file, 0, "parameters.rail_trade_bonus");
+  output_type_iterate(o) {
+    terrain_control.rail_tile_bonus[o] =
+      secfile_lookup_int_default(file, 0, "parameters.rail_%s_bonus",
+                                get_output_identifier(o));
+  } output_type_iterate_end;
   terrain_control.farmland_supermarket_food_bonus =
     secfile_lookup_int_default(file, 50, 
"parameters.farmland_supermarket_food_bonus");
   terrain_control.pollution_food_penalty =

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#11503) put rail_bonus values into an array, Jason Short <=