Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2004:
[Freeciv-Dev] (PR#11228) pcity->surplus field
Home

[Freeciv-Dev] (PR#11228) pcity->surplus field

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11228) pcity->surplus field
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 27 Nov 2004 14:49:45 -0800
Reply-to: rt@xxxxxxxxxxx

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

This patch takes the surplus fields of the city struct and merges them 
into an array.  The same should eventually be done with other fields 
(total, waste, production, usage, bonus).  This cleanup will make 
several things easier.  The current system is hard to use because the 
field names are not consistent between output types.  This is a problem 
for the CMA because it means everything is special-cased and there's a 
lot more code.  It's a problem in miscellaneous code (e.g., the citydlg 
tooltips patch) because it's easy to misuse a variable.  The current 
system is also hard to extend because *everything* is special-cased so 
there's no way to have any of the settings come from the ruleset (like 
having specialists be able to produce shields, for instance).

As for the patch itself, it's pretty simple.

* pcity->food_surplus is universally replaced with pcity->surplus[O_FOOD].

* pcity->shield_surplus is universally replaced with 
pcity->surplus[O_SHIELD].

* pcity->trade_prod is universally replaced with pcity->surplus[O_TRADE].

* pcity->surplus[O_LUXURY] is a new value that is equal to 
pcity->luxury_total.  luxury_total is the "total" luxury not the 
surplus, but these are equal because there is no wasted/used luxury. 
The surplus[O_LUXURY] value is only used in the CM code (because it 
needed one user and changing this was really easy).

* pcity->surplus[O_SCIENCE] is a new value that is equal to 
pcity->science_total.  The logic here is exactly the same as with 
surplus[O_LUXURY].

* pcity->surplus[O_GOLD] is a new value equal to 
city_gold_surplus(pcity, pcity->tax_total).  This value is set in the 
same way as luxury and science, but here the surplus and total 
production are not the same because some gold is consumed.  Again it is 
only used in the CM code.

The last three are new pieces of data that were not previously cached. 
Eventually we should start using them in many/most places instead of the 
_total fields (this is particularly true for gold since 
city_gold_surplus() is slow).  But for now nothing is changed (except 
for one place in the CM code).

In particular the network code is NOT changed.  The situation right now 
is that some cached fields (pcity->food_surplus) are sent from server to 
client while others (pcity->food_bonus) are not.  There's not really any 
logic behind this since all of these fields are set by 
generic_city_refresh.  So what ends up happening is that some client 
operations (like citydlg display) will work without a refresh while 
others (like CM) will not.  Eventually we should make this consistent 
one way or the other - but for now I just don't change anything.

jason

Index: ai/advdomestic.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdomestic.c,v
retrieving revision 1.121
diff -u -r1.121 advdomestic.c
--- ai/advdomestic.c    20 Oct 2004 18:20:53 -0000      1.121
+++ ai/advdomestic.c    27 Nov 2004 22:15:19 -0000
@@ -149,7 +149,7 @@
   Unit_Type_id unit_type;
   /* Food surplus assuming that workers and elvii are already accounted for
    * and properly balanced. */
-  int est_food = pcity->food_surplus
+  int est_food = pcity->surplus[O_FOOD]
                  + 2 * pcity->specialists[SP_SCIENTIST]
                  + 2 * pcity->specialists[SP_TAXMAN];
 
Index: ai/advmilitary.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advmilitary.c,v
retrieving revision 1.179
diff -u -r1.179 advmilitary.c
--- ai/advmilitary.c    25 Nov 2004 05:34:34 -0000      1.179
+++ ai/advmilitary.c    27 Nov 2004 22:15:20 -0000
@@ -1218,7 +1218,7 @@
   case HELI_MOVING:
   case AIR_MOVING:
     if ((id = ai_find_source_building(pplayer, EFT_AIR_VETERAN)) != B_LAST
-        && pcity->shield_surplus > impr_build_shield_cost(id) / 10) {
+        && pcity->surplus[O_SHIELD] > impr_build_shield_cost(id) / 10) {
       /* Only build this if we have really high production */
       choice->choice = id;
       choice->type = CT_BUILDING;
@@ -1275,7 +1275,7 @@
     } else { 
       danger = 100 * pcity->ai.danger / our_def;
     }
-    if (pcity->shield_surplus <= 0 && our_def != 0) {
+    if (pcity->surplus[O_SHIELD] <= 0 && our_def != 0) {
       /* Won't be able to support anything */
       danger = 0;
     }
@@ -1353,7 +1353,7 @@
     }
   } /* ok, don't need to defend */
 
-  if (pcity->shield_surplus <= 0 
+  if (pcity->surplus[O_SHIELD] <= 0 
       || pcity->ppl_unhappy[4] > pcity->ppl_unhappy[2]) {
     /* Things we consider below are not life-saving so we don't want to 
      * build them if our populace doesn't feel like it */
Index: ai/aicity.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v
retrieving revision 1.177
diff -u -r1.177 aicity.c
--- ai/aicity.c 31 Oct 2004 21:52:20 -0000      1.177
+++ ai/aicity.c 27 Nov 2004 22:15:20 -0000
@@ -68,8 +68,8 @@
   } } city_list_iterate_end; }
 
 #define CITY_EMERGENCY(pcity)                        \
- (pcity->shield_surplus < 0 || city_unhappy(pcity)   \
-  || pcity->food_stock + pcity->food_surplus < 0)
+ (pcity->surplus[O_SHIELD] < 0 || city_unhappy(pcity)   \
+  || pcity->food_stock + pcity->surplus[O_FOOD] < 0)
 #define LOG_BUY LOG_DEBUG
 
 static void resolve_city_emergency(struct player *pplayer, struct city *pcity);
@@ -82,8 +82,8 @@
 **************************************************************************/
 int ai_eval_calc_city(struct city *pcity, struct ai_data *ai)
 {
-  int i = (pcity->food_surplus * ai->food_priority
-           + pcity->shield_surplus * ai->shield_priority
+  int i = (pcity->surplus[O_FOOD] * ai->food_priority
+           + pcity->surplus[O_SHIELD] * ai->shield_priority
            + pcity->luxury_total * ai->luxury_priority
            + pcity->tax_total * ai->gold_priority
            + pcity->science_total * ai->science_priority
@@ -92,7 +92,7 @@
            - pcity->ppl_angry[4] * ai->angry_priority
            - pcity->pollution * ai->pollution_priority);
 
-  if (pcity->food_surplus < 0 || pcity->shield_surplus < 0) {
+  if (pcity->surplus[O_FOOD] < 0 || pcity->surplus[O_SHIELD] < 0) {
     /* The city is unmaintainable, it can't be good */
     i = MIN(i, 0);
   }
@@ -301,7 +301,7 @@
                * (nplayers - amount)) / (nplayers * amount * 100);
            break;
          case EFT_GROWTH_FOOD:
-           v += c * 4 + (amount / 7) * pcity->food_surplus;
+           v += c * 4 + (amount / 7) * pcity->surplus[O_FOOD];
            break;
          case EFT_AIRLIFT:
             /* FIXME: We need some smart algorithm here. The below is 
@@ -356,9 +356,9 @@
            /* there not being a break here is deliberate, mind you */
          case EFT_SIZE_ADJ: 
             if (!city_can_grow_to(pcity, pcity->size + 1)) {
-             v += pcity->food_surplus * ai->food_priority * amount;
+             v += pcity->surplus[O_FOOD] * ai->food_priority * amount;
               if (pcity->size == game.aqueduct_size) {
-                v += 30 * pcity->food_surplus;
+                v += 30 * pcity->surplus[O_FOOD];
               }
            }
            v += c * amount * 4 / game.aqueduct_size;
@@ -498,7 +498,7 @@
    }
 
   /* Adjust by building cost */
-  v -= pimpr->build_cost / (pcity->shield_surplus * 10 + 1);
+  v -= pimpr->build_cost / (pcity->surplus[O_SHIELD] * 10 + 1);
 
   /* Set */
   pcity->ai.building_want[id] = v;
@@ -530,7 +530,7 @@
         pcity->ai.building_want[id] = 0; /* do recalc */
       }
       if (city_got_building(pcity, id)
-          || pcity->shield_surplus == 0
+          || pcity->surplus[O_SHIELD] == 0
           || !can_build_improvement(pcity, id)
           || improvement_redundant(pplayer, pcity, id, FALSE)) {
         continue; /* Don't build redundant buildings */
@@ -874,7 +874,7 @@
       if (get_city_bonus(pcity, EFT_GROWTH_FOOD) == 0
           && pcity->size == 1
           && city_granary_size(pcity->size)
-             > pcity->food_stock + pcity->food_surplus) {
+             > pcity->food_stock + pcity->surplus[O_FOOD]) {
         /* Don't buy settlers in size 1 cities unless we grow next turn */
         continue;
       } else if (city_list_size(&pplayer->cities) > 6) {
@@ -1044,7 +1044,7 @@
           "Emergency in %s (%s, angry%d, unhap%d food%d, prod%d)",
           pcity->name, city_unhappy(pcity) ? "unhappy" : "content",
           pcity->ppl_angry[4], pcity->ppl_unhappy[4],
-          pcity->food_surplus, pcity->shield_surplus);
+          pcity->surplus[O_FOOD], pcity->surplus[O_SHIELD]);
 
   city_list_init(&minilist);
   map_city_radius_iterate(pcity->tile, ptile) {
Index: ai/aidata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aidata.c,v
retrieving revision 1.46
diff -u -r1.46 aidata.c
--- ai/aidata.c 23 Oct 2004 19:01:01 -0000      1.46
+++ ai/aidata.c 27 Nov 2004 22:15:20 -0000
@@ -269,7 +269,7 @@
   ai->stats.average_production = 0;
   city_list_iterate(pplayer->cities, pcity) {
     ai->stats.cities[(int)map_get_continent(pcity->tile)]++;
-    ai->stats.average_production += pcity->shield_surplus;
+    ai->stats.average_production += pcity->surplus[O_SHIELD];
   } city_list_iterate_end;
   ai->stats.average_production /= MAX(1, city_list_size(&pplayer->cities));
   BV_CLR_ALL(ai->stats.diplomat_reservations);
Index: ai/aihand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aihand.c,v
retrieving revision 1.93
diff -u -r1.93 aihand.c
--- ai/aihand.c 24 Nov 2004 03:34:55 -0000      1.93
+++ ai/aihand.c 27 Nov 2004 22:15:20 -0000
@@ -167,7 +167,7 @@
       total_cities++;
 
       if (cmr.found_a_valid
-          && pcity->food_surplus > 0
+          && pcity->surplus[O_FOOD] > 0
           && pcity->size >= g->rapture_size
          && city_can_grow_to(pcity, pcity->size + 1)) {
         pcity->ai.celebrate = TRUE;
Index: ai/aihunt.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aihunt.c,v
retrieving revision 1.10
diff -u -r1.10 aihunt.c
--- ai/aihunt.c 18 Nov 2004 07:44:28 -0000      1.10
+++ ai/aihunt.c 27 Nov 2004 22:15:20 -0000
@@ -103,7 +103,8 @@
       desire /= 2;
     }
 
-    desire = amortize(desire, ut->build_cost / MAX(pcity->shield_surplus, 1));
+    desire = amortize(desire,
+                     ut->build_cost / MAX(pcity->surplus[O_SHIELD], 1));
 
     if (desire > best) {
         best = desire;
@@ -160,7 +161,8 @@
       desire /= 2;
     }
 
-    desire = amortize(desire, ut->build_cost / MAX(pcity->shield_surplus, 1));
+    desire = amortize(desire,
+                     ut->build_cost / MAX(pcity->surplus[O_SHIELD], 1));
 
     if (desire > best) {
         best = desire;
Index: ai/aitools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aitools.c,v
retrieving revision 1.130
diff -u -r1.130 aitools.c
--- ai/aitools.c        25 Nov 2004 06:29:49 -0000      1.130
+++ ai/aitools.c        27 Nov 2004 22:15:20 -0000
@@ -66,7 +66,7 @@
                       int value, int delay, int build_cost)
 {
   struct ai_data *ai = ai_data_get(pplayer);
-  int city_output = (pcity ? pcity->shield_surplus : 1);
+  int city_output = (pcity ? pcity->surplus[O_SHIELD] : 1);
   int output = MAX(city_output, ai->stats.average_production);
   int build_time = build_cost / MAX(output, 1);
 
@@ -402,8 +402,8 @@
        the greater good -- Per */
     return FALSE;
   }
-  if (pcity->shield_surplus - unit_type(punit)->shield_cost >= 0
-      && pcity->food_surplus - unit_type(punit)->food_cost >= 0) {
+  if (pcity->surplus[O_SHIELD] - unit_type(punit)->shield_cost >= 0
+      && pcity->surplus[O_FOOD] - unit_type(punit)->food_cost >= 0) {
     handle_unit_change_homecity(unit_owner(punit), punit->id, pcity->id);
     return TRUE;
   }
Index: ai/aiunit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aiunit.c,v
retrieving revision 1.339
diff -u -r1.339 aiunit.c
--- ai/aiunit.c 22 Nov 2004 15:04:36 -0000      1.339
+++ ai/aiunit.c 27 Nov 2004 22:15:21 -0000
@@ -1893,7 +1893,7 @@
     if ((pcity = wonder_on_continent(pplayer, 
                                      map_get_continent(punit->tile))) 
         && unit_flag(punit, F_HELP_WONDER)
-        && build_points_left(pcity) > (pcity->shield_surplus * 2)) {
+        && build_points_left(pcity) > (pcity->surplus[O_SHIELD] * 2)) {
       if (!same_pos(pcity->tile, punit->tile)) {
         if (punit->moves_left == 0) {
           return;
Index: client/citydlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/citydlg_common.c,v
retrieving revision 1.50
diff -u -r1.50 citydlg_common.c
--- client/citydlg_common.c     16 Oct 2004 00:00:10 -0000      1.50
+++ client/citydlg_common.c     27 Nov 2004 22:15:21 -0000
@@ -240,7 +240,7 @@
 
   if (get_current_construction_bonus(pcity, EFT_PROD_TO_GOLD) > 0) {
     my_snprintf(buffer, buffer_len, _("%3d gold per turn"),
-               MAX(0, pcity->shield_surplus));
+               MAX(0, pcity->surplus[O_SHIELD]));
   } else {
     char time[50];
 
@@ -281,7 +281,8 @@
 {
   if (!is_unit && building_has_effect(id, EFT_PROD_TO_GOLD)) {
     my_snprintf(buffer, buffer_len, _("%s (XX) %d/turn"),
-               get_impr_name_ex(pcity, id), MAX(0, pcity->shield_surplus));
+               get_impr_name_ex(pcity, id),
+               MAX(0, pcity->surplus[O_SHIELD]));
   } else {
     int turns = city_turns_to_build(pcity, id, is_unit, TRUE);
     const char *name;
@@ -365,7 +366,7 @@
   if (pcity) {
     if (!is_unit && building_has_effect(id, EFT_PROD_TO_GOLD)) {
       my_snprintf(buf[3], column_size, _("%d/turn"),
-                 MAX(0, pcity->shield_surplus));
+                 MAX(0, pcity->surplus[O_SHIELD]));
     } else {
       int turns = city_turns_to_build(pcity, id, is_unit, FALSE);
       if (turns < 999) {
Index: client/cityrepdata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/cityrepdata.c,v
retrieving revision 1.39
diff -u -r1.39 cityrepdata.c
--- client/cityrepdata.c        30 Sep 2004 17:14:37 -0000      1.39
+++ client/cityrepdata.c        27 Nov 2004 22:15:21 -0000
@@ -229,9 +229,9 @@
 {
   static char buf[32];
   my_snprintf(buf, sizeof(buf), "%d/%d/%d",
-             pcity->food_surplus, 
-             pcity->shield_surplus, 
-             pcity->trade_prod);
+             pcity->surplus[O_FOOD], 
+             pcity->surplus[O_SHIELD], 
+             pcity->surplus[O_TRADE]);
   return buf;
 }
 
@@ -239,7 +239,7 @@
 {
   static char buf[8];
   my_snprintf(buf, sizeof(buf), "%3d",
-             pcity->food_surplus);
+             pcity->surplus[O_FOOD]);
   return buf;
 }
 
@@ -247,7 +247,7 @@
 {
   static char buf[8];
   my_snprintf(buf, sizeof(buf), "%3d",
-             pcity->shield_surplus);
+             pcity->surplus[O_SHIELD]);
   return buf;
 }
 
@@ -255,7 +255,7 @@
 {
   static char buf[8];
   my_snprintf(buf, sizeof(buf), "%3d",
-             pcity->trade_prod);
+             pcity->surplus[O_TRADE]);
   return buf;
 }
 
@@ -348,7 +348,7 @@
   if (get_current_construction_bonus(pcity, EFT_PROD_TO_GOLD) > 0) {
     my_snprintf(buf, sizeof(buf), "%s (%d/X/X/X)%s",
                get_impr_name_ex(pcity, pcity->currently_building),
-               MAX(0, pcity->shield_surplus), from_worklist);
+               MAX(0, pcity->surplus[O_SHIELD]), from_worklist);
   } else {
     int turns = city_turns_to_build(pcity, pcity->currently_building,
                                    pcity->is_building_unit, TRUE);
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   27 Nov 2004 22:15:22 -0000
@@ -418,15 +418,15 @@
     /* Check if city desciptions should be updated */
     if (draw_city_names && name_changed) {
       update_descriptions = TRUE;
-    } else if (draw_city_productions &&
-              (pcity->is_building_unit != packet->is_building_unit ||
-               pcity->currently_building != packet->currently_building ||
-               pcity->shield_surplus != packet->shield_surplus ||
-               pcity->shield_stock != packet->shield_stock)) {
+    } else if (draw_city_productions
+              && (pcity->is_building_unit != packet->is_building_unit
+                  || pcity->currently_building != packet->currently_building
+                  || pcity->surplus[O_SHIELD] != packet->shield_surplus
+                  || pcity->shield_stock != packet->shield_stock)) {
       update_descriptions = TRUE;
     } else if (draw_city_names && draw_city_growth &&
               (pcity->food_stock != packet->food_stock ||
-               pcity->food_surplus != packet->food_surplus)) {
+               pcity->surplus[O_FOOD] != packet->food_surplus)) {
       /* If either the food stock or surplus have changed, the time-to-grow
         is likely to have changed as well. */
       update_descriptions = TRUE;
@@ -457,10 +457,10 @@
   }
   
   pcity->food_prod=packet->food_prod;
-  pcity->food_surplus=packet->food_surplus;
+  pcity->surplus[O_FOOD] = packet->food_surplus;
   pcity->shield_prod=packet->shield_prod;
-  pcity->shield_surplus=packet->shield_surplus;
-  pcity->trade_prod=packet->trade_prod;
+  pcity->surplus[O_SHIELD] = packet->shield_surplus;
+  pcity->surplus[O_TRADE] = packet->trade_prod;
   pcity->tile_trade=packet->tile_trade;
   pcity->corruption=packet->corruption;
   pcity->shield_waste=packet->shield_waste;
@@ -747,10 +747,8 @@
       pcity->trade_value[i] = 0;
     }
     pcity->food_prod          = 0;
-    pcity->food_surplus       = 0;
+    memset(pcity->surplus, 0, O_COUNT * sizeof(*pcity->surplus));
     pcity->shield_prod        = 0;
-    pcity->shield_surplus     = 0;
-    pcity->trade_prod         = 0;
     pcity->corruption         = 0;
     pcity->luxury_total       = 0;
     pcity->tax_total          = 0;
Index: client/repodlgs_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/repodlgs_common.c,v
retrieving revision 1.16
diff -u -r1.16 repodlgs_common.c
--- client/repodlgs_common.c    29 Sep 2004 02:24:19 -0000      1.16
+++ client/repodlgs_common.c    27 Nov 2004 22:15:22 -0000
@@ -82,7 +82,7 @@
   city_list_iterate(game.player_ptr->cities, pcity) {
     *total_income += pcity->tax_total;
     if (get_current_construction_bonus(pcity, EFT_PROD_TO_GOLD) > 0) {
-      *total_income += MAX(0, pcity->shield_surplus);
+      *total_income += MAX(0, pcity->surplus[O_SHIELD]);
     }
   } city_list_iterate_end;
 }
Index: client/gui-gtk/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/citydlg.c,v
retrieving revision 1.187
diff -u -r1.187 citydlg.c
--- client/gui-gtk/citydlg.c    29 Sep 2004 02:24:19 -0000      1.187
+++ client/gui-gtk/citydlg.c    27 Nov 2004 22:15:23 -0000
@@ -1689,12 +1689,13 @@
   /* fill the buffers with the necessary info */
 
   my_snprintf(buf[FOOD], sizeof(buf[FOOD]), "%2d (%+2d)",
-             pcity->food_prod, pcity->food_surplus);
+             pcity->food_prod, pcity->surplus[O_FOOD]);
   my_snprintf(buf[SHIELD], sizeof(buf[SHIELD]), "%2d (%+2d)",
              pcity->shield_prod + pcity->shield_waste,
-             pcity->shield_surplus);
+             pcity->surplus[O_SHIELD]);
   my_snprintf(buf[TRADE], sizeof(buf[TRADE]), "%2d (%+2d)",
-             pcity->trade_prod + pcity->corruption, pcity->trade_prod);
+             pcity->surplus[O_TRADE] + pcity->corruption,
+             pcity->surplus[O_TRADE]);
   my_snprintf(buf[GOLD], sizeof(buf[GOLD]), "%2d (%+2d)",
              pcity->tax_total, city_gold_surplus(pcity, pcity->tax_total));
   my_snprintf(buf[LUXURY], sizeof(buf[LUXURY]), "%2d      ",
@@ -1739,7 +1740,7 @@
   style = (granaryturns > -4 && granaryturns < 0) ? RED : NORMAL;
   gtk_widget_modify_style(info_label[GRANARY], info_label_style[style]);
 
-  style = (granaryturns == 0 || pcity->food_surplus < 0) ? RED : NORMAL;
+  style = (granaryturns == 0 || pcity->surplus[O_FOOD] < 0) ? RED : NORMAL;
   gtk_widget_modify_style(info_label[GROWTH], info_label_style[style]);
 
   /* someone could add the info_label_style[ORANGE]
Index: client/gui-gtk-2.0/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/citydlg.c,v
retrieving revision 1.100
diff -u -r1.100 citydlg.c
--- client/gui-gtk-2.0/citydlg.c        13 Nov 2004 23:22:43 -0000      1.100
+++ client/gui-gtk-2.0/citydlg.c        27 Nov 2004 22:15:23 -0000
@@ -1320,12 +1320,13 @@
   /* fill the buffers with the necessary info */
 
   my_snprintf(buf[FOOD], sizeof(buf[FOOD]), "%2d (%+2d)",
-             pcity->food_prod, pcity->food_surplus);
+             pcity->food_prod, pcity->surplus[O_FOOD]);
   my_snprintf(buf[SHIELD], sizeof(buf[SHIELD]), "%2d (%+2d)",
              pcity->shield_prod + pcity->shield_waste,
-             pcity->shield_surplus);
+             pcity->surplus[O_SHIELD]);
   my_snprintf(buf[TRADE], sizeof(buf[TRADE]), "%2d (%+2d)",
-             pcity->trade_prod + pcity->corruption, pcity->trade_prod);
+             pcity->surplus[O_TRADE] + pcity->corruption,
+             pcity->surplus[O_TRADE]);
   my_snprintf(buf[GOLD], sizeof(buf[GOLD]), "%2d (%+2d)",
              pcity->tax_total, city_gold_surplus(pcity, pcity->tax_total));
   my_snprintf(buf[LUXURY], sizeof(buf[LUXURY]), "%2d      ",
@@ -1369,7 +1370,7 @@
   style = (granaryturns > -4 && granaryturns < 0) ? RED : NORMAL;
   gtk_widget_modify_style(info_label[GRANARY], info_label_style[style]);
 
-  style = (granaryturns == 0 || pcity->food_surplus < 0) ? RED : NORMAL;
+  style = (granaryturns == 0 || pcity->surplus[O_FOOD] < 0) ? RED : NORMAL;
   gtk_widget_modify_style(info_label[GROWTH], info_label_style[style]);
 
   /* someone could add the info_label_style[ORANGE]
Index: client/gui-win32/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/citydlg.c,v
retrieving revision 1.85
diff -u -r1.85 citydlg.c
--- client/gui-win32/citydlg.c  29 Sep 2004 06:26:11 -0000      1.85
+++ client/gui-win32/citydlg.c  27 Nov 2004 22:15:23 -0000
@@ -442,9 +442,11 @@
   struct city *pcity=pdialog->pcity;
   my_snprintf(buf, sizeof(buf),
              _("Food:    %2d (%+2d)\nProd:    %2d (%+2d)\nTrade:   %2d 
(%+2d)"),
-             pcity->food_prod, pcity->food_surplus,
-             pcity->shield_prod + pcity->shield_waste, pcity->shield_surplus,
-             pcity->trade_prod+pcity->corruption, pcity->trade_prod);          
    
+             pcity->food_prod, pcity->surplus[O_FOOD],
+             pcity->shield_prod + pcity->shield_waste,
+             pcity->surplus[O_SHIELD],
+             pcity->surplus[O_TRADE] + pcity->corruption,
+             pcity->surplus[O_TRADE]);              
   SetWindowText(pdialog->prod_area[0],buf);
   SetWindowText(pdialog->prod_area[1],buf);
 }
Index: client/gui-xaw/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/citydlg.c,v
retrieving revision 1.123
diff -u -r1.123 citydlg.c
--- client/gui-xaw/citydlg.c    29 Sep 2004 02:24:22 -0000      1.123
+++ client/gui-xaw/citydlg.c    27 Nov 2004 22:15:24 -0000
@@ -240,11 +240,11 @@
   if (pdialog) {
     pcity=pdialog->pcity;
     foodprod=pcity->food_prod;
-    foodsurplus=pcity->food_surplus;
+    foodsurplus = pcity->surplus[O_FOOD];
     shieldprod=pcity->shield_prod + pcity->shield_waste;
-    shieldsurplus=pcity->shield_surplus;
-    tradeprod=pcity->trade_prod+pcity->corruption;
-    tradesurplus=pcity->trade_prod;
+    shieldsurplus = pcity->surplus[O_SHIELD];
+    tradeprod = pcity->surplus[O_TRADE]+pcity->corruption;
+    tradesurplus = pcity->surplus[O_TRADE];
   }
 
   my_snprintf(retbuf, n,
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       27 Nov 2004 22:15:24 -0000
@@ -1043,7 +1043,7 @@
 
   /* Should this be real_map_distance? */
   tb = map_distance(pc1->tile, pc2->tile) + 10;
-  tb = (tb * (pc1->trade_prod + pc2->trade_prod)) / 24;
+  tb = (tb * (pc1->surplus[O_TRADE] + pc2->surplus[O_TRADE])) / 24;
 
   /*  fudge factor to more closely approximate Civ2 behavior (Civ2 is
    * really very different -- this just fakes it a little better) */
@@ -1155,7 +1155,7 @@
 {
   struct government *g = get_gov_pcity(pcity);
 
-  return (pcity->rapture > 0 && pcity->food_surplus > 0
+  return (pcity->rapture > 0 && pcity->surplus[O_FOOD] > 0
          && (pcity->rapture % game.rapturedelay) == 0
          && government_has_flag(g, G_RAPTURE_CITY_GROWTH));
 }
@@ -1406,7 +1406,7 @@
 int city_turns_to_build(const struct city *pcity, int id, bool id_is_unit,
                        bool include_shield_stock)
 {
-  int city_shield_surplus = pcity->shield_surplus;
+  int city_shield_surplus = pcity->surplus[O_SHIELD];
   int city_shield_stock = include_shield_stock ?
       city_change_production_penalty(pcity, id, id_is_unit) : 0;
   int improvement_cost = id_is_unit ?
@@ -1432,12 +1432,12 @@
 **************************************************************************/
 int city_turns_to_grow(const struct city *pcity)
 {
-  if (pcity->food_surplus > 0) {
+  if (pcity->surplus[O_FOOD] > 0) {
     return (city_granary_size(pcity->size) - pcity->food_stock +
-           pcity->food_surplus - 1) / pcity->food_surplus;
-  } else if (pcity->food_surplus < 0) {
+           pcity->surplus[O_FOOD] - 1) / pcity->surplus[O_FOOD];
+  } else if (pcity->surplus[O_FOOD] < 0) {
     /* turns before famine loss */
-    return -1 + (pcity->food_stock / pcity->food_surplus);
+    return -1 + (pcity->food_stock / pcity->surplus[O_FOOD]);
   } else {
     return FC_INFINITY;
   }
@@ -1656,7 +1656,7 @@
 
 /**************************************************************************
   Get the incomes of a city according to the taxrates (ignore # of 
-  specialists). trade should usually be pcity->trade_prod.
+  specialists). trade should usually be pcity->surplus[O_TRADE].
 **************************************************************************/
 void get_tax_income(struct player *pplayer, int trade, int *sci, 
                     int *lux, int *tax)
@@ -1704,7 +1704,7 @@
 **************************************************************************/
 static inline void set_tax_income(struct city *pcity)
 {
-  get_tax_income(city_owner(pcity), pcity->trade_prod, &pcity->science_total, 
+  get_tax_income(city_owner(pcity), pcity->surplus[O_TRADE], 
&pcity->science_total, 
                  &pcity->luxury_total, &pcity->tax_total);
 
   specialist_type_iterate(sp) {
@@ -1736,7 +1736,17 @@
   pcity->luxury_total = (pcity->luxury_total * pcity->luxury_bonus) / 100;
   pcity->tax_total = (pcity->tax_total * pcity->tax_bonus) / 100;
   pcity->science_total = (pcity->science_total * pcity->science_bonus) / 100;
-  pcity->shield_surplus = pcity->shield_prod;
+  pcity->surplus[O_SHIELD] = pcity->shield_prod;
+}
+
+/**************************************************************************
+  Set tax surpluses from the base productions.
+**************************************************************************/
+static void set_tax_surplus(struct city *pcity)
+{
+  pcity->surplus[O_SCIENCE] = pcity->science_total;
+  pcity->surplus[O_LUXURY] = pcity->luxury_total;
+  pcity->surplus[O_GOLD] = city_gold_surplus(pcity, pcity->tax_total);
 }
 
 /**************************************************************************
@@ -1934,10 +1944,10 @@
 static inline void unhappy_city_check(struct city *pcity)
 {
   if (city_unhappy(pcity)) {
-    pcity->food_surplus = MIN(0, pcity->food_surplus);
+    pcity->surplus[O_FOOD] = MIN(0, pcity->surplus[O_FOOD]);
     pcity->tax_total = 0;
     pcity->science_total = 0;
-    pcity->shield_surplus = MIN(0, pcity->shield_surplus);
+    pcity->surplus[O_SHIELD] = MIN(0, pcity->surplus[O_SHIELD]);
   }
 }
 
@@ -1996,22 +2006,22 @@
 static inline void set_food_trade_shields(struct city *pcity)
 {
   int i;
-  pcity->food_surplus = 0;
-  pcity->shield_surplus = 0;
+  pcity->surplus[O_FOOD] = 0;
+  pcity->surplus[O_SHIELD] = 0;
 
-  get_food_trade_shields(pcity, &pcity->food_prod, &pcity->trade_prod,
+  get_food_trade_shields(pcity, &pcity->food_prod, &pcity->surplus[O_TRADE],
                          &pcity->shield_prod);
   
-  pcity->tile_trade = pcity->trade_prod;
-  pcity->food_surplus = pcity->food_prod - pcity->size * 2;
+  pcity->tile_trade = pcity->surplus[O_TRADE];
+  pcity->surplus[O_FOOD] = pcity->food_prod - pcity->size * 2;
 
   for (i = 0; i < NUM_TRADEROUTES; i++) {
     pcity->trade_value[i] =
        trade_between_cities(pcity, find_city_by_id(pcity->trade[i]));
-    pcity->trade_prod += pcity->trade_value[i];
+    pcity->surplus[O_TRADE] += pcity->trade_value[i];
   }
-  pcity->corruption = city_corruption(pcity, pcity->trade_prod);
-  pcity->trade_prod -= pcity->corruption;
+  pcity->corruption = city_corruption(pcity, pcity->surplus[O_TRADE]);
+  pcity->surplus[O_TRADE] -= pcity->corruption;
 
   pcity->shield_waste = city_waste(pcity, pcity->shield_prod);
   pcity->shield_prod -= pcity->shield_waste;
@@ -2120,14 +2130,14 @@
     if (shield_cost > 0) {
       adjust_city_free_cost(&free_shield, &shield_cost);
       if (shield_cost > 0) {
-       pcity->shield_surplus -= shield_cost;
+       pcity->surplus[O_SHIELD] -= shield_cost;
        this_unit->upkeep = shield_cost;
       }
     }
     if (food_cost > 0) {
       adjust_city_free_cost(&free_food, &food_cost);
       if (food_cost > 0) {
-       pcity->food_surplus -= food_cost;
+       pcity->surplus[O_FOOD] -= food_cost;
        this_unit->upkeep_food = food_cost;
       }
     }
@@ -2165,6 +2175,7 @@
   citizen_happy_size(pcity);
   set_tax_income(pcity);       /* calc base luxury, tax & bulbs */
   add_buildings_effect(pcity); /* marketplace, library wonders.. */
+  set_tax_surplus(pcity);
   pcity->pollution = city_pollution(pcity, pcity->shield_prod);
   citizen_happy_luxury(pcity); /* with our new found luxuries */
   citizen_content_buildings(pcity);    /* temple cathedral colosseum */
@@ -2447,7 +2458,7 @@
   }
   pcity->food_stock = 0;
   pcity->shield_stock = 0;
-  pcity->trade_prod = 0;
+  pcity->surplus[O_TRADE] = 0;
   pcity->tile_trade = 0;
   pcity->original = pplayer->player_no;
 
Index: common/city.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.h,v
retrieving revision 1.169
diff -u -r1.169 city.h
--- common/city.h       26 Nov 2004 09:49:12 -0000      1.169
+++ common/city.h       27 Nov 2004 22:15:24 -0000
@@ -244,10 +244,13 @@
   int trade[NUM_TRADEROUTES], trade_value[NUM_TRADEROUTES];
 
   /* the productions */
-  int food_prod, food_surplus;
+  int surplus[O_MAX]; /* Final surplus in each category. */
+
+  int food_prod;
+
   /* Shield production is shields produced minus shield_waste*/
-  int shield_prod, shield_surplus, shield_waste; 
-  int trade_prod, corruption, tile_trade;
+  int shield_prod, shield_waste; 
+  int corruption, tile_trade;
 
   /* Cached values for CPU savings. */
   int shield_bonus, luxury_bonus, tax_bonus, science_bonus;
Index: common/player.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/player.c,v
retrieving revision 1.160
diff -u -r1.160 player.c
--- common/player.c     17 Nov 2004 16:59:07 -0000      1.160
+++ common/player.c     27 Nov 2004 22:15:24 -0000
@@ -398,7 +398,7 @@
 
     /* Capitalization income. */
     if (get_current_construction_bonus(pcity, EFT_PROD_TO_GOLD) > 0) {
-      income += pcity->shield_stock + pcity->shield_surplus;
+      income += pcity->shield_stock + pcity->surplus[O_SHIELD];
     }
   } city_list_iterate_end;
 
Index: common/aicore/cm.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/aicore/cm.c,v
retrieving revision 1.48
diff -u -r1.48 cm.c
--- common/aicore/cm.c  26 Nov 2004 22:42:38 -0000      1.48
+++ common/aicore/cm.c  27 Nov 2004 22:15:25 -0000
@@ -684,12 +684,9 @@
                             int surplus[],
                             bool *disorder, bool *happy)
 {
-  surplus[O_FOOD] = pcity->food_surplus;
-  surplus[O_SHIELD] = pcity->shield_surplus;
-  surplus[O_TRADE] = pcity->trade_prod;
-  surplus[O_GOLD] = city_gold_surplus(pcity, pcity->tax_total);
-  surplus[O_LUXURY] = pcity->luxury_total;
-  surplus[O_SCIENCE] = pcity->science_total;
+  output_type_iterate(o) {
+    surplus[o] = pcity->surplus[o];
+  } output_type_iterate_end;
 
   *disorder = city_unhappy(pcity);
   *happy = city_happy(pcity);
@@ -1533,7 +1530,7 @@
    * prod-surplus; otherwise, we know it's at least 2*size but we
    * can't easily compute the settlers. */
   if (!city_unhappy(pcity)) {
-    usage[O_FOOD] = pcity->food_prod - pcity->food_surplus;
+    usage[O_FOOD] = pcity->food_prod - pcity->surplus[O_FOOD];
   } else {
     usage[O_FOOD] = pcity->size * 2;
   }
@@ -1556,7 +1553,7 @@
   if (!city_unhappy(pcity)) {
     double sbonus;
 
-    usage[O_SHIELD] = pcity->shield_prod - pcity->shield_surplus;
+    usage[O_SHIELD] = pcity->shield_prod - pcity->surplus[O_SHIELD];
 
     sbonus = ((double)pcity->shield_bonus) / 100.0;
     sbonus += .1;
@@ -2068,10 +2065,10 @@
   } my_city_map_iterate_end;
 
   freelog(LOG_NORMAL, "  food    = %3d (%+3d)",
-          pcity->food_prod, pcity->food_surplus);
+          pcity->food_prod, pcity->surplus[O_FOOD]);
   freelog(LOG_NORMAL, "  shield  = %3d (%+3d)",
-          pcity->shield_prod, pcity->shield_surplus);
-  freelog(LOG_NORMAL, "  trade   = %3d", pcity->trade_prod);
+          pcity->shield_prod, pcity->surplus[O_SHIELD]);
+  freelog(LOG_NORMAL, "  trade   = %3d", pcity->surplus[O_TRADE]);
 
   freelog(LOG_NORMAL, "  gold    = %3d (%+3d)", pcity->tax_total,
           city_gold_surplus(pcity, pcity->tax_total));
Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.280
diff -u -r1.280 citytools.c
--- server/citytools.c  23 Nov 2004 17:44:25 -0000      1.280
+++ server/citytools.c  27 Nov 2004 22:15:26 -0000
@@ -1584,10 +1584,10 @@
   }
 
   packet->food_prod=pcity->food_prod;
-  packet->food_surplus=pcity->food_surplus;
+  packet->food_surplus=pcity->surplus[O_FOOD];
   packet->shield_prod=pcity->shield_prod;
-  packet->shield_surplus=pcity->shield_surplus;
-  packet->trade_prod=pcity->trade_prod;
+  packet->shield_surplus=pcity->surplus[O_SHIELD];
+  packet->trade_prod=pcity->surplus[O_TRADE];
   packet->tile_trade=pcity->tile_trade;
   packet->corruption=pcity->corruption;
   
Index: server/cityturn.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v
retrieving revision 1.275
diff -u -r1.275 cityturn.c
--- server/cityturn.c   25 Nov 2004 05:34:35 -0000      1.275
+++ server/cityturn.c   27 Nov 2004 22:15:26 -0000
@@ -313,15 +313,15 @@
   int turns_growth, turns_granary;
   bool can_grow;
  
-  if (pcity->food_surplus > 0) {
+  if (pcity->surplus[O_FOOD] > 0) {
     turns_growth = (city_granary_size(pcity->size) - pcity->food_stock - 1)
-                  / pcity->food_surplus;
+                  / pcity->surplus[O_FOOD];
 
     if (get_city_bonus(pcity, EFT_GROWTH_FOOD) == 0
        && get_current_construction_bonus(pcity, EFT_GROWTH_FOOD) > 0
-       && pcity->shield_surplus > 0) {
+       && pcity->surplus[O_SHIELD] > 0) {
       turns_granary = (impr_build_shield_cost(pcity->currently_building)
-                      - pcity->shield_stock) / pcity->shield_surplus;
+                      - pcity->shield_stock) / pcity->surplus[O_SHIELD];
       /* if growth and granary completion occur simultaneously, granary
         preserves food.  -AJS */
       if (turns_growth < 5 && turns_granary < 5
@@ -343,7 +343,8 @@
                       pcity->name, pcity->size + 1);
     }
   } else {
-    if (pcity->food_stock + pcity->food_surplus <= 0 && pcity->food_surplus < 
0) {
+    if (pcity->food_stock + pcity->surplus[O_FOOD] <= 0
+       && pcity->surplus[O_FOOD] < 0) {
       notify_conn_ex(dest, pcity->tile,
                     E_CITY_FAMINE_FEARED,
                     _("Game: Warning: Famine feared in %s."),
@@ -494,9 +495,10 @@
       have_square = TRUE;
     }
   } city_map_iterate_end;
-  if (((pcity->food_surplus >= 2) || !have_square)  &&  pcity->size >= 5  &&
-      (is_city_option_set(pcity, CITYO_NEW_EINSTEIN) || 
-       is_city_option_set(pcity, CITYO_NEW_TAXMAN))) {
+  if (((pcity->surplus[O_FOOD] >= 2) || !have_square)
+      && pcity->size >= 5
+      && (is_city_option_set(pcity, CITYO_NEW_EINSTEIN)
+         || is_city_option_set(pcity, CITYO_NEW_TAXMAN))) {
 
     if (is_city_option_set(pcity, CITYO_NEW_EINSTEIN)) {
       pcity->specialists[SP_SCIENTIST]++;
@@ -524,7 +526,7 @@
 **************************************************************************/
 static void city_populate(struct city *pcity)
 {
-  pcity->food_stock+=pcity->food_surplus;
+  pcity->food_stock+=pcity->surplus[O_FOOD];
   if(pcity->food_stock >= city_granary_size(pcity->size) 
      || city_rapture_grow(pcity)) {
     city_increase_size(pcity);
@@ -836,21 +838,21 @@
 {
   struct government *g = get_gov_pplayer(pplayer);
 
-  if (pcity->shield_surplus < 0) {
+  if (pcity->surplus[O_SHIELD] < 0) {
     unit_list_iterate_safe(pcity->units_supported, punit) {
       if (utype_shield_cost(unit_type(punit), g) > 0
-         && pcity->shield_surplus < 0
+         && pcity->surplus[O_SHIELD] < 0
           && !unit_flag(punit, F_UNDISBANDABLE)) {
        notify_player_ex(pplayer, pcity->tile, E_UNIT_LOST,
                         _("Game: %s can't upkeep %s, unit disbanded."),
                         pcity->name, unit_type(punit)->name);
         handle_unit_disband(pplayer, punit->id);
-       /* pcity->shield_surplus is automatically updated. */
+       /* pcity->surplus[O_SHIELD] is automatically updated. */
       }
     } unit_list_iterate_safe_end;
   }
 
-  if (pcity->shield_surplus < 0) {
+  if (pcity->surplus[O_SHIELD] < 0) {
     /* Special case: F_UNDISBANDABLE. This nasty unit won't go so easily.
      * It'd rather make the citizens pay in blood for their failure to upkeep
      * it! If we make it here all normal units are already disbanded, so only
@@ -858,7 +860,7 @@
     unit_list_iterate_safe(pcity->units_supported, punit) {
       int upkeep = utype_shield_cost(unit_type(punit), g);
 
-      if (upkeep > 0 && pcity->shield_surplus < 0) {
+      if (upkeep > 0 && pcity->surplus[O_SHIELD] < 0) {
        assert(unit_flag(punit, F_UNDISBANDABLE));
        notify_player_ex(pplayer, pcity->tile, E_UNIT_LOST,
                         _("Game: Citizens in %s perish for their failure to "
@@ -868,15 +870,15 @@
        }
 
        /* No upkeep for the unit this turn. */
-       pcity->shield_surplus += upkeep;
+       pcity->surplus[O_SHIELD] += upkeep;
       }
     } unit_list_iterate_safe_end;
   }
 
   /* Now we confirm changes made last turn. */
-  pcity->shield_stock += pcity->shield_surplus;
+  pcity->shield_stock += pcity->surplus[O_SHIELD];
   pcity->before_change_shields = pcity->shield_stock;
-  pcity->last_turns_shield_surplus = pcity->shield_surplus;
+  pcity->last_turns_shield_surplus = pcity->surplus[O_SHIELD];
 
   return TRUE;
 }
@@ -890,7 +892,7 @@
   int mod;
 
   if (get_current_construction_bonus(pcity, EFT_PROD_TO_GOLD) > 0) {
-    assert(pcity->shield_surplus >= 0);
+    assert(pcity->surplus[O_SHIELD] >= 0);
     /* pcity->before_change_shields already contains the surplus from
      * this turn. */
     pplayer->economic.gold += pcity->before_change_shields;
Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.208
diff -u -r1.208 savegame.c
--- server/savegame.c   24 Nov 2004 00:23:10 -0000      1.208
+++ server/savegame.c   27 Nov 2004 22:15:27 -0000
@@ -1969,7 +1969,7 @@
                                                 plrno, i);
     pcity->shield_stock=secfile_lookup_int(file, "player%d.c%d.shield_stock", 
                                                   plrno, i);
-    pcity->tile_trade=pcity->trade_prod=0;
+    pcity->tile_trade = pcity->surplus[O_TRADE] = 0;
     pcity->anarchy=secfile_lookup_int(file, "player%d.c%d.anarchy", plrno,i);
     pcity->rapture=secfile_lookup_int_default(file, 0, "player%d.c%d.rapture", 
plrno,i);
     pcity->was_happy=secfile_lookup_bool(file, "player%d.c%d.was_happy", 
plrno,i);
Index: server/score.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/score.c,v
retrieving revision 1.10
diff -u -r1.10 score.c
--- server/score.c      25 Nov 2004 06:29:49 -0000      1.10
+++ server/score.c      27 Nov 2004 22:15:27 -0000
@@ -411,8 +411,8 @@
     pplayer->score.cities++;
     pplayer->score.pollution += pcity->pollution;
     pplayer->score.techout += pcity->science_total;
-    pplayer->score.bnp += pcity->trade_prod;
-    pplayer->score.mfg += pcity->shield_surplus;
+    pplayer->score.bnp += pcity->surplus[O_TRADE];
+    pplayer->score.mfg += pcity->surplus[O_SHIELD];
 
     bonus = CLIP(0, get_city_bonus(pcity, EFT_SCIENCE_BONUS), 100);
     pplayer->score.literacy += (city_population(pcity) * bonus) / 100;
Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.211
diff -u -r1.211 srv_main.c
--- server/srv_main.c   25 Nov 2004 06:29:49 -0000      1.211
+++ server/srv_main.c   27 Nov 2004 22:15:27 -0000
@@ -657,7 +657,7 @@
         workers += pcity->size;
         shields += pcity->shield_prod;
         food += pcity->food_prod;
-        trade += pcity->trade_prod;
+        trade += pcity->surplus[O_TRADE];
       } city_list_iterate_end;
       gamelog(GAMELOG_NORMAL, "INFO %s cities %d, pop %d "
               "food %d, prod %d, trade %d, settlers %d, units %d",

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#11228) pcity->surplus field, Jason Short <=