Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2004:
[Freeciv-Dev] (PR#11231) turn min_city_center values into an array
Home

[Freeciv-Dev] (PR#11231) turn min_city_center values into an array

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11231) turn min_city_center values into an array
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 27 Nov 2004 16:57:02 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=11231 >

Quite straightforward.  min_city_center_food becomes 
min_city_center_output[O_FOOD], and so on.  There are no network changes.

jason

Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.424
diff -u -r1.424 packhand.c
--- client/packhand.c   26 Nov 2004 22:42:37 -0000      1.424
+++ client/packhand.c   28 Nov 2004 00:52:47 -0000
@@ -2672,9 +2672,10 @@
   game.rgame.forced_science = packet->forced_science;
   game.rgame.forced_luxury = packet->forced_luxury;
   game.rgame.forced_gold = packet->forced_gold;
-  game.rgame.min_city_center_food = packet->min_city_center_food;
-  game.rgame.min_city_center_shield = packet->min_city_center_shield;
-  game.rgame.min_city_center_trade = packet->min_city_center_trade;
+  game.rgame.min_city_center_output[O_FOOD] = packet->min_city_center_food;
+  game.rgame.min_city_center_output[O_SHIELD]
+    = packet->min_city_center_shield;
+  game.rgame.min_city_center_output[O_TRADE] = packet->min_city_center_trade;
   game.rgame.min_dist_bw_cities = packet->min_dist_bw_cities;
   game.rgame.init_vis_radius_sq = packet->init_vis_radius_sq;
   game.rgame.hut_overflight = packet->hut_overflight;
Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.260
diff -u -r1.260 city.c
--- common/city.c       27 Nov 2004 20:42:00 -0000      1.260
+++ common/city.c       28 Nov 2004 00:52:48 -0000
@@ -622,7 +622,7 @@
   }
 
   if (pcity && is_city_center(city_x, city_y)) {
-    s = MAX(s, game.rgame.min_city_center_shield);
+    s = MAX(s, game.rgame.min_city_center_output[O_SHIELD]);
   }
 
   return s;
@@ -725,7 +725,7 @@
   }
 
   if (pcity && is_city_center(city_x, city_y)) {
-    t = MAX(t, game.rgame.min_city_center_trade);
+    t = MAX(t, game.rgame.min_city_center_output[O_TRADE]);
   }
 
   return t;
@@ -836,7 +836,7 @@
   }
 
   if (pcity && is_city_center(city_x, city_y)) {
-    f = MAX(f, game.rgame.min_city_center_food);
+    f = MAX(f, game.rgame.min_city_center_output[O_FOOD]);
   }
 
   return f;
Index: common/game.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.h,v
retrieving revision 1.160
diff -u -r1.160 game.h
--- common/game.h       26 Nov 2004 22:42:38 -0000      1.160
+++ common/game.h       28 Nov 2004 00:52:48 -0000
@@ -203,9 +203,7 @@
     int forced_science; /* only relevant if !changable_tax */
     int forced_luxury;
     int forced_gold;
-    int min_city_center_food;
-    int min_city_center_shield;
-    int min_city_center_trade;
+    int min_city_center_output[O_MAX];
     int min_dist_bw_cities;
     int init_vis_radius_sq;
     int hut_overflight;
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.201
diff -u -r1.201 ruleset.c
--- server/ruleset.c    26 Nov 2004 22:42:38 -0000      1.201
+++ server/ruleset.c    28 Nov 2004 00:52:49 -0000
@@ -2644,12 +2644,12 @@
   (void) check_ruleset_capabilities(&file, "+1.11.1", filename);
   (void) section_file_lookup(&file, "datafile.description");   /* unused */
 
-  game.rgame.min_city_center_food =
-    secfile_lookup_int(&file, "civstyle.min_city_center_food");
-  game.rgame.min_city_center_shield =
-    secfile_lookup_int(&file, "civstyle.min_city_center_shield");
-  game.rgame.min_city_center_trade =
-    secfile_lookup_int(&file, "civstyle.min_city_center_trade");
+  output_type_iterate(o) {
+    game.rgame.min_city_center_output[o]
+      = secfile_lookup_int_default(&file, 0,
+                                  "civstyle.min_city_center_%s",
+                                  get_output_identifier(o));
+  } output_type_iterate_end;
 
   /* if the server variable citymindist is set (!= 0) the ruleset
      setting is overwritten by citymindist */
@@ -3171,9 +3171,10 @@
   misc_p.forced_science = game.rgame.forced_science;
   misc_p.forced_luxury = game.rgame.forced_luxury;
   misc_p.forced_gold = game.rgame.forced_gold;
-  misc_p.min_city_center_food = game.rgame.min_city_center_food;
-  misc_p.min_city_center_shield = game.rgame.min_city_center_shield;
-  misc_p.min_city_center_trade = game.rgame.min_city_center_trade;
+  misc_p.min_city_center_food = game.rgame.min_city_center_output[O_FOOD];
+  misc_p.min_city_center_shield
+    = game.rgame.min_city_center_output[O_SHIELD];
+  misc_p.min_city_center_trade = game.rgame.min_city_center_output[O_TRADE];
   misc_p.min_dist_bw_cities = game.rgame.min_dist_bw_cities;
   misc_p.init_vis_radius_sq = game.rgame.init_vis_radius_sq;
   misc_p.hut_overflight = game.rgame.hut_overflight;

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