Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2004:
[Freeciv-Dev] (PR#11439) put city production in an array
Home

[Freeciv-Dev] (PR#11439) put city production in an array

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11439) put city production in an array
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 9 Dec 2004 12:46:47 -0800
Reply-to: bugs@xxxxxxxxxxx

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

This patch takes the city production values (food_prod, shield_prod, 
science_total, luxury_total, tax_total) and puts them in an array prod[] 
that is indexed by output type.

Although length it's actually very simple.  I first made the base 
changes (see base.diff, attached also) then simply did 
search-and-replace for all fields.

Note that currently there is no trade_prod field.  There is a tile_trade 
but it's not the same at all.  So this patch adds this field and sets it 
properly (it's always the same as surplus[O_TRADE]).  This is also in 
base.diff.

Many of the callers of this could use some scrutiny.  In particular the 
city.c code can be simplified a fair amount.  Some of the AI callers 
might want to look at surplus[] instead of prod[].  And most of the 
callers who call city_gold_surplus(pcity, prod[O_GOLD]) can instead just 
look at surplus[O_GOLD].  This will all come later.

-jason

Index: ai/aicity.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v
retrieving revision 1.181
diff -u -r1.181 aicity.c
--- ai/aicity.c 9 Dec 2004 20:17:46 -0000       1.181
+++ ai/aicity.c 9 Dec 2004 20:40:41 -0000
@@ -84,9 +84,9 @@
 {
   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
+           + pcity->prod[O_LUXURY] * ai->luxury_priority
+           + pcity->prod[O_GOLD] * ai->gold_priority
+           + pcity->prod[O_SCIENCE] * ai->science_priority
            + pcity->ppl_happy[4] * ai->happy_priority
            - pcity->ppl_unhappy[4] * ai->unhappy_priority
            - pcity->ppl_angry[4] * ai->angry_priority
Index: ai/aidiplomat.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aidiplomat.c,v
retrieving revision 1.41
diff -u -r1.41 aidiplomat.c
--- ai/aidiplomat.c     18 Oct 2004 23:28:12 -0000      1.41
+++ ai/aidiplomat.c     9 Dec 2004 20:40:41 -0000
@@ -177,11 +177,11 @@
         && (incite_cost < pplayer->economic.gold - pplayer->ai.est_upkeep)) {
       /* incite gain (FIXME: we should count wonders too but need to
          cache that somehow to avoid CPU hog -- Per) */
-      gain_incite = acity->food_prod * FOOD_WEIGHTING
-                    + acity->shield_prod * SHIELD_WEIGHTING
-                    + (acity->luxury_total
-                       + acity->tax_total
-                       + acity->science_total) * TRADE_WEIGHTING;
+      gain_incite = acity->prod[O_FOOD] * FOOD_WEIGHTING
+                    + acity->prod[O_SHIELD] * SHIELD_WEIGHTING
+                    + (acity->prod[O_LUXURY]
+                       + acity->prod[O_GOLD]
+                       + acity->prod[O_SCIENCE]) * TRADE_WEIGHTING;
       gain_incite *= SHIELD_WEIGHTING; /* WAG cost to take city otherwise */
       gain_incite -= incite_cost * TRADE_WEIGHTING;
     }
Index: client/cityrepdata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/cityrepdata.c,v
retrieving revision 1.43
diff -u -r1.43 cityrepdata.c
--- client/cityrepdata.c        9 Dec 2004 18:29:58 -0000       1.43
+++ client/cityrepdata.c        9 Dec 2004 20:40:41 -0000
@@ -273,12 +273,12 @@
   static char buf[32];
   int goldie;
 
-  goldie = city_gold_surplus(pcity, pcity->tax_total);
+  goldie = city_gold_surplus(pcity, pcity->prod[O_GOLD]);
   my_snprintf(buf, sizeof(buf), "%s%d/%d/%d",
              (goldie < 0) ? "-" : (goldie > 0) ? "+" : "",
              (goldie < 0) ? (-goldie) : goldie,
-             pcity->luxury_total,
-             pcity->science_total);
+             pcity->prod[O_LUXURY],
+             pcity->prod[O_SCIENCE]);
   return buf;
 }
 
@@ -286,11 +286,11 @@
                                 const void *data)
 {
   static char buf[8];
-  int income = city_gold_surplus(pcity, pcity->tax_total);
+  int income = city_gold_surplus(pcity, pcity->prod[O_GOLD]);
   if (income > 0) {
     my_snprintf(buf, sizeof(buf), "+%d", income);
   } else {
-    my_snprintf(buf, sizeof(buf), "%3d", city_gold_surplus(pcity, 
pcity->tax_total));
+    my_snprintf(buf, sizeof(buf), "%3d", city_gold_surplus(pcity, 
pcity->prod[O_GOLD]));
   }
   return buf;
 }
@@ -300,7 +300,7 @@
 {
   static char buf[8];
   my_snprintf(buf, sizeof(buf), "%3d",
-             pcity->luxury_total);
+             pcity->prod[O_LUXURY]);
   return buf;
 }
 
@@ -309,7 +309,7 @@
 {
   static char buf[8];
   my_snprintf(buf, sizeof(buf), "%3d",
-             pcity->science_total);
+             pcity->prod[O_SCIENCE]);
   return buf;
 }
 
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.442
diff -u -r1.442 packhand.c
--- client/packhand.c   9 Dec 2004 18:29:58 -0000       1.442
+++ client/packhand.c   9 Dec 2004 20:40:42 -0000
@@ -455,19 +455,14 @@
     pcity->trade[i]=packet->trade[i];
     pcity->trade_value[i]=packet->trade_value[i];
   }
-  
-  pcity->food_prod=packet->food_prod;
+
   output_type_iterate(o) {
     pcity->surplus[o] = packet->surplus[o];
     pcity->waste[o] = packet->waste[o];
+    pcity->prod[o] = packet->prod[o];
   } output_type_iterate_end;
-  pcity->shield_prod=packet->shield_prod;
   pcity->tile_trade=packet->tile_trade;
 
-  pcity->luxury_total=packet->luxury_total;
-  pcity->tax_total=packet->tax_total;
-  pcity->science_total=packet->science_total;
-  
   pcity->food_stock=packet->food_stock;
   pcity->shield_stock=packet->shield_stock;
   pcity->pollution=packet->pollution;
@@ -745,13 +740,9 @@
       pcity->trade[i] = 0;
       pcity->trade_value[i] = 0;
     }
-    pcity->food_prod          = 0;
     memset(pcity->surplus, 0, O_COUNT * sizeof(*pcity->surplus));
-    pcity->shield_prod        = 0;
     memset(pcity->waste, 0, O_COUNT * sizeof(*pcity->waste));
-    pcity->luxury_total       = 0;
-    pcity->tax_total          = 0;
-    pcity->science_total      = 0;
+    memset(pcity->prod, 0, O_COUNT * sizeof(*pcity->prod));
     pcity->food_stock         = 0;
     pcity->shield_stock       = 0;
     pcity->pollution          = 0;
Index: client/repodlgs_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/repodlgs_common.c,v
retrieving revision 1.19
diff -u -r1.19 repodlgs_common.c
--- client/repodlgs_common.c    8 Dec 2004 04:18:09 -0000       1.19
+++ client/repodlgs_common.c    9 Dec 2004 20:40:42 -0000
@@ -80,7 +80,7 @@
   *total_income = 0;
 
   city_list_iterate(game.player_ptr->cities, pcity) {
-    *total_income += pcity->tax_total;
+    *total_income += pcity->prod[O_GOLD];
     if (get_current_construction_bonus(pcity, EFT_PROD_TO_GOLD) > 0) {
       *total_income += MAX(0, pcity->surplus[O_SHIELD]);
     }
Index: client/text.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/text.c,v
retrieving revision 1.17
diff -u -r1.17 text.c
--- client/text.c       8 Dec 2004 20:48:33 -0000       1.17
+++ client/text.c       9 Dec 2004 20:40:42 -0000
@@ -415,7 +415,7 @@
 
     if (plr == pplayer) {
       city_list_iterate(pplayer->cities, pcity) {
-        ours += pcity->science_total;
+        ours += pcity->prod[O_SCIENCE];
       } city_list_iterate_end;
     } else if (ds == DS_TEAM) {
       theirs += pplayer->research.bulbs_last_turn;
Index: client/gui-gtk/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/citydlg.c,v
retrieving revision 1.189
diff -u -r1.189 citydlg.c
--- client/gui-gtk/citydlg.c    9 Dec 2004 18:29:58 -0000       1.189
+++ client/gui-gtk/citydlg.c    9 Dec 2004 20:40:43 -0000
@@ -1689,20 +1689,20 @@
   /* fill the buffers with the necessary info */
 
   my_snprintf(buf[FOOD], sizeof(buf[FOOD]), "%2d (%+2d)",
-             pcity->food_prod, pcity->surplus[O_FOOD]);
+             pcity->prod[O_FOOD], pcity->surplus[O_FOOD]);
   my_snprintf(buf[SHIELD], sizeof(buf[SHIELD]), "%2d (%+2d)",
-             pcity->shield_prod + pcity->waste[O_SHIELD],
+             pcity->prod[O_SHIELD] + pcity->waste[O_SHIELD],
              pcity->surplus[O_SHIELD]);
   my_snprintf(buf[TRADE], sizeof(buf[TRADE]), "%2d (%+2d)",
              pcity->surplus[O_TRADE] + pcity->waste[O_TRADE],
              pcity->surplus[O_TRADE]);
   my_snprintf(buf[GOLD], sizeof(buf[GOLD]), "%2d (%+2d)",
-             pcity->tax_total, city_gold_surplus(pcity, pcity->tax_total));
+             pcity->prod[O_GOLD], city_gold_surplus(pcity, 
pcity->prod[O_GOLD]));
   my_snprintf(buf[LUXURY], sizeof(buf[LUXURY]), "%2d      ",
-             pcity->luxury_total);
+             pcity->prod[O_LUXURY]);
 
   my_snprintf(buf[SCIENCE], sizeof(buf[SCIENCE]), "%2d",
-             pcity->science_total);
+             pcity->prod[O_SCIENCE]);
 
   my_snprintf(buf[GRANARY], sizeof(buf[GRANARY]), "%d/%-d",
              pcity->food_stock, city_granary_size(pcity->size));
Index: client/gui-gtk/happiness.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/happiness.c,v
retrieving revision 1.18
diff -u -r1.18 happiness.c
--- client/gui-gtk/happiness.c  16 Jul 2004 19:37:57 -0000      1.18
+++ client/gui-gtk/happiness.c  9 Dec 2004 20:40:43 -0000
@@ -265,7 +265,7 @@
   struct city *pcity = pdialog->pcity;
 
   my_snprintf(bptr, nleft, _("Luxury: %d total."),
-             pcity->luxury_total);
+             pcity->prod[O_LUXURY]);
 
   gtk_set_label(pdialog->hlabels[LUXURIES], buf);
 }
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.104
diff -u -r1.104 citydlg.c
--- client/gui-gtk-2.0/citydlg.c        9 Dec 2004 18:29:58 -0000       1.104
+++ client/gui-gtk-2.0/citydlg.c        9 Dec 2004 20:40:43 -0000
@@ -1320,20 +1320,20 @@
   /* fill the buffers with the necessary info */
 
   my_snprintf(buf[FOOD], sizeof(buf[FOOD]), "%2d (%+2d)",
-             pcity->food_prod, pcity->surplus[O_FOOD]);
+             pcity->prod[O_FOOD], pcity->surplus[O_FOOD]);
   my_snprintf(buf[SHIELD], sizeof(buf[SHIELD]), "%2d (%+2d)",
-             pcity->shield_prod + pcity->waste[O_SHIELD],
+             pcity->prod[O_SHIELD] + pcity->waste[O_SHIELD],
              pcity->surplus[O_SHIELD]);
   my_snprintf(buf[TRADE], sizeof(buf[TRADE]), "%2d (%+2d)",
              pcity->surplus[O_TRADE] + pcity->waste[O_TRADE],
              pcity->surplus[O_TRADE]);
   my_snprintf(buf[GOLD], sizeof(buf[GOLD]), "%2d (%+2d)",
-             pcity->tax_total, city_gold_surplus(pcity, pcity->tax_total));
+             pcity->prod[O_GOLD], city_gold_surplus(pcity, 
pcity->prod[O_GOLD]));
   my_snprintf(buf[LUXURY], sizeof(buf[LUXURY]), "%2d      ",
-             pcity->luxury_total);
+             pcity->prod[O_LUXURY]);
 
   my_snprintf(buf[SCIENCE], sizeof(buf[SCIENCE]), "%2d",
-             pcity->science_total);
+             pcity->prod[O_SCIENCE]);
 
   my_snprintf(buf[GRANARY], sizeof(buf[GRANARY]), "%d/%-d",
              pcity->food_stock, city_granary_size(pcity->size));
Index: client/gui-gtk-2.0/happiness.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/happiness.c,v
retrieving revision 1.15
diff -u -r1.15 happiness.c
--- client/gui-gtk-2.0/happiness.c      16 Jul 2004 19:37:57 -0000      1.15
+++ client/gui-gtk-2.0/happiness.c      9 Dec 2004 20:40:43 -0000
@@ -259,7 +259,7 @@
   struct city *pcity = pdialog->pcity;
 
   my_snprintf(bptr, nleft, _("Luxury: %d total."),
-             pcity->luxury_total);
+             pcity->prod[O_LUXURY]);
 
   gtk_label_set_text(GTK_LABEL(pdialog->hlabels[LUXURIES]), buf);
 }
Index: client/gui-mui/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/citydlg.c,v
retrieving revision 1.87
diff -u -r1.87 citydlg.c
--- client/gui-mui/citydlg.c    9 Dec 2004 18:29:58 -0000       1.87
+++ client/gui-mui/citydlg.c    9 Dec 2004 20:40:43 -0000
@@ -1806,14 +1806,14 @@
   granarystyle = (pcity->food_surplus < 0 && granaryturns < 4) ? RED : NORMAL;
   pollutionstyle = (pcity->pollution >= 10) ? RED : NORMAL;
 
-  settextf(info->food_text, "%2d (%+2d)", pcity->food_prod, 
pcity->food_surplus);
-  settextf(info->shield_text, "%2d (%+2d)", pcity->shield_prod + 
pcity->waste[O_SHIELD], pcity->shield_surplus);
+  settextf(info->food_text, "%2d (%+2d)", pcity->prod[O_FOOD], 
pcity->food_surplus);
+  settextf(info->shield_text, "%2d (%+2d)", pcity->prod[O_SHIELD] + 
pcity->waste[O_SHIELD], pcity->shield_surplus);
   settextf(info->trade_text, "%2d (%+2d)",
           pcity->trade_prod + pcity->waste[O_TRADE],
           pcity->trade_prod);
-  settextf(info->gold_text, "%2d (%+2d)", pcity->tax_total, 
city_gold_surplus(pcity, pcity->tax_total));
-  settextf(info->luxury_text, "%2d", pcity->luxury_total);
-  settextf(info->science_text, "%2d", pcity->science_total);
+  settextf(info->gold_text, "%2d (%+2d)", pcity->prod[O_GOLD], 
city_gold_surplus(pcity, pcity->prod[O_GOLD]));
+  settextf(info->luxury_text, "%2d", pcity->prod[O_LUXURY]);
+  settextf(info->science_text, "%2d", pcity->prod[O_SCIENCE]);
 
   set(info->granary_text, MUIA_Text_PreParse, granarystyle==RED?MUIX_B:"");
   set(info->growth_text, MUIA_Text_PreParse, growthstyle==RED?MUIX_B:"");
@@ -2228,7 +2228,7 @@
 
   /* LUXURY */
   my_snprintf(bptr, nleft, _("Luxury: %d total (maximum %d usable). "),
-             pcity->luxury_total, 2 * pcity->size);
+             pcity->prod[O_LUXURY], 2 * pcity->size);
 
   settext(pdialog->happiness_citizen_text[1], buf);
 
Index: client/gui-sdl/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/citydlg.c,v
retrieving revision 1.47
diff -u -r1.47 citydlg.c
--- client/gui-sdl/citydlg.c    9 Dec 2004 18:29:58 -0000       1.47
+++ client/gui-sdl/citydlg.c    9 Dec 2004 20:40:44 -0000
@@ -2726,7 +2726,7 @@
   /* ================================================================= */
   /* food label */
   my_snprintf(cBuf, sizeof(cBuf), _("Food : %d per turn"),
-             pCity->food_prod);
+             pCity->prod[O_FOOD]);
 
   copy_chars_to_string16(pStr, cBuf);
   pStr->fgcol = *get_game_colorRGB(COLOR_STD_GROUND);
@@ -2745,9 +2745,9 @@
   dest.x = pWindow->size.x + 203;
 
   if (pCity->food_surplus >= 0) {
-    count = pCity->food_prod - pCity->food_surplus;
+    count = pCity->prod[O_FOOD] - pCity->food_surplus;
   } else {
-    count = pCity->food_prod;
+    count = pCity->prod[O_FOOD];
   }
 
   if (((pIcons->pBIG_Food->w + 1) * count) > 200) {
@@ -2811,7 +2811,7 @@
   /* productions label */
   my_snprintf(cBuf, sizeof(cBuf), _("Production : %d (%d) per turn"),
              pCity->shield_surplus ,
-                 pCity->shield_prod + pCity->waste[O_SHIELD]);
+                 pCity->prod[O_SHIELD] + pCity->waste[O_SHIELD]);
 
   copy_chars_to_string16(pStr, cBuf);
   pStr->fgcol = *get_game_colorRGB(COLOR_STD_CITY_PROD);
@@ -2856,7 +2856,7 @@
 
   /* support shields label */
   my_snprintf(cBuf, sizeof(cBuf), Q_("?production:Support : %d"),
-         pCity->shield_prod + pCity->waste[O_SHIELD] - pCity->shield_surplus);
+         pCity->prod[O_SHIELD] + pCity->waste[O_SHIELD] - 
pCity->shield_surplus);
 
   copy_chars_to_string16(pStr, cBuf);
   pStr->fgcol = *get_game_colorRGB(COLOR_STD_CITY_SUPPORT);
@@ -2871,20 +2871,20 @@
   FREESURFACE(pBuf);
 
   /* draw support shields */
-  if (pCity->shield_prod - pCity->shield_surplus) {
+  if (pCity->prod[O_SHIELD] - pCity->shield_surplus) {
     dest.x = pWindow->size.x + 423;
     dest.y =
        pWindow->size.y + 281 + (16 - pIcons->pBIG_Shield->h) / 2;
-    if ((pIcons->pBIG_Shield->w + 1) * (pCity->shield_prod -
+    if ((pIcons->pBIG_Shield->w + 1) * (pCity->prod[O_SHIELD] -
                                            pCity->shield_surplus) > 30) {
       step =
-         (30 - pIcons->pBIG_Food->w) / (pCity->shield_prod -
+         (30 - pIcons->pBIG_Food->w) / (pCity->prod[O_SHIELD] -
                                             pCity->shield_surplus - 1);
     } else {
       step = pIcons->pBIG_Shield->w + 1;
     }
 
-    for (i = 0; i < (pCity->shield_prod - pCity->shield_surplus); i++) {
+    for (i = 0; i < (pCity->prod[O_SHIELD] - pCity->shield_surplus); i++) {
       SDL_BlitSurface(pIcons->pBIG_Shield, NULL, pWindow->dst, &dest);
       dest.x -= step;
     }
@@ -2966,7 +2966,7 @@
   /* ================================================================= */
   /* gold label */
   my_snprintf(cBuf, sizeof(cBuf), _("Gold: %d (%d) per turn"),
-             city_gold_surplus(pCity, pcity->tax_total), pCity->tax_total);
+             city_gold_surplus(pCity, pcity->prod[O_GOLD]), 
pCity->prod[O_GOLD]);
 
   copy_chars_to_string16(pStr, cBuf);
   pStr->fgcol = *get_game_colorRGB(COLOR_STD_CITY_GOLD);
@@ -2981,7 +2981,7 @@
   FREESURFACE(pBuf);
 
   /* draw coins */
-  count = city_gold_surplus(pCity, pcity->tax_total);
+  count = city_gold_surplus(pCity, pcity->prod[O_GOLD]);
   if (count) {
 
     if (count > 0) {
@@ -3012,8 +3012,8 @@
   }
 
   /* upkeep label */
-  my_snprintf(cBuf, sizeof(cBuf), _("Upkeep : %d"), pCity->tax_total -
-             city_gold_surplus(pCity, pcity->tax_total));
+  my_snprintf(cBuf, sizeof(cBuf), _("Upkeep : %d"), pCity->prod[O_GOLD] -
+             city_gold_surplus(pCity, pcity->prod[O_GOLD]));
 
   copy_chars_to_string16(pStr, cBuf);
   pStr->fgcol = *get_game_colorRGB(COLOR_STD_CITY_UNKEEP);
@@ -3028,22 +3028,22 @@
   FREESURFACE(pBuf);
 
   /* draw upkeep */
-  count = city_gold_surplus(pCity, pcity->tax_total);
-  if (pCity->tax_total - count) {
+  count = city_gold_surplus(pCity, pcity->prod[O_GOLD]);
+  if (pCity->prod[O_GOLD] - count) {
 
     dest.x = pWindow->size.x + 423;
     dest.y = pWindow->size.y + 359
       + (16 - pIcons->pBIG_Coin_UpKeep->h) / 2;
 
     if (((pIcons->pBIG_Coin_UpKeep->w + 1) *
-        (pCity->tax_total - count)) > 110) {
+        (pCity->prod[O_GOLD] - count)) > 110) {
       step = (110 - pIcons->pBIG_Coin_UpKeep->w) /
-         (pCity->tax_total - count - 1);
+         (pCity->prod[O_GOLD] - count - 1);
     } else {
       step = pIcons->pBIG_Coin_UpKeep->w + 1;
     }
 
-    for (i = 0; i < (pCity->tax_total - count); i++) {
+    for (i = 0; i < (pCity->prod[O_GOLD] - count); i++) {
       SDL_BlitSurface(pIcons->pBIG_Coin_UpKeep, NULL, pWindow->dst,
                      &dest);
       dest.x -= step;
@@ -3052,7 +3052,7 @@
   /* ================================================================= */
   /* science label */
   my_snprintf(cBuf, sizeof(cBuf), _("Science: %d per turn"),
-             pCity->science_total);
+             pCity->prod[O_SCIENCE]);
 
   copy_chars_to_string16(pStr, cBuf);
   pStr->fgcol = *get_game_colorRGB(COLOR_STD_CITY_SCIENCE);
@@ -3067,7 +3067,7 @@
   FREESURFACE(pBuf);
 
   /* draw colb */
-  count = pCity->science_total;
+  count = pCity->prod[O_SCIENCE];
   if (count) {
 
     dest.y =
@@ -3092,7 +3092,7 @@
   /* ================================================================= */
   /* luxury label */
   my_snprintf(cBuf, sizeof(cBuf), _("Luxury: %d per turn"),
-             pCity->luxury_total);
+             pCity->prod[O_LUXURY]);
 
   copy_chars_to_string16(pStr, cBuf);
   pStr->fgcol = *get_game_colorRGB(COLOR_STD_CITY_LUX);
@@ -3107,20 +3107,20 @@
   FREESURFACE(pBuf);
 
   /* draw luxury */
-  if (pCity->luxury_total) {
+  if (pCity->prod[O_LUXURY]) {
 
     dest.y =
        pWindow->size.y + 429 + (16 - pIcons->pBIG_Luxury->h) / 2;
     dest.x = pWindow->size.x + 203;
 
-    if ((pIcons->pBIG_Luxury->w * pCity->luxury_total) > 235) {
+    if ((pIcons->pBIG_Luxury->w * pCity->prod[O_LUXURY]) > 235) {
       step =
-         (235 - pIcons->pBIG_Luxury->w) / (pCity->luxury_total - 1);
+         (235 - pIcons->pBIG_Luxury->w) / (pCity->prod[O_LUXURY] - 1);
     } else {
       step = pIcons->pBIG_Luxury->w;
     }
 
-    for (i = 0; i < pCity->luxury_total; i++) {
+    for (i = 0; i < pCity->prod[O_LUXURY]; i++) {
       SDL_BlitSurface(pIcons->pBIG_Luxury, NULL, pWindow->dst, &dest);
       dest.x += step;
     }
Index: client/gui-sdl/cityrep.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/cityrep.c,v
retrieving revision 1.16
diff -u -r1.16 cityrep.c
--- client/gui-sdl/cityrep.c    9 Dec 2004 18:29:59 -0000       1.16
+++ client/gui-sdl/cityrep.c    9 Dec 2004 20:40:44 -0000
@@ -303,7 +303,7 @@
     pBuf->action = popup_cma_from_city_report_callback;
         
     /* ----------- */
-    my_snprintf(cBuf, sizeof(cBuf), "%d", pCity->food_prod - 
pCity->food_surplus);
+    my_snprintf(cBuf, sizeof(cBuf), "%d", pCity->prod[O_FOOD] - 
pCity->food_surplus);
     pStr = create_str16_from_char(cBuf, 10);
     pStr->style |= SF_CENTER;
     pStr->fgcol = *get_game_colorRGB(COLOR_STD_GROUND);
@@ -386,7 +386,7 @@
     add_to_gui_list(MAX_ID - pCity->id, pBuf);
             
     /* ----------- */
-    my_snprintf(cBuf, sizeof(cBuf), "%d", city_gold_surplus(pCity, 
pcity->tax_total));
+    my_snprintf(cBuf, sizeof(cBuf), "%d", city_gold_surplus(pCity, 
pcity->prod[O_GOLD]));
     pStr = create_str16_from_char(cBuf, 10);
     pStr->style |= SF_CENTER;
     pStr->fgcol = *get_game_colorRGB(COLOR_STD_CITY_GOLD);
@@ -400,7 +400,7 @@
     add_to_gui_list(MAX_ID - pCity->id, pBuf);
     
     /* ----------- */
-    my_snprintf(cBuf, sizeof(cBuf), "%d", pCity->science_total);
+    my_snprintf(cBuf, sizeof(cBuf), "%d", pCity->prod[O_SCIENCE]);
     pStr = create_str16_from_char(cBuf, 10);
     pStr->style |= SF_CENTER;
     pStr->fgcol = *get_game_colorRGB(COLOR_STD_CITY_SCIENCE);
@@ -414,7 +414,7 @@
     add_to_gui_list(MAX_ID - pCity->id, pBuf);
     
     /* ----------- */
-    my_snprintf(cBuf, sizeof(cBuf), "%d", pCity->luxury_total);
+    my_snprintf(cBuf, sizeof(cBuf), "%d", pCity->prod[O_LUXURY]);
     pStr = create_str16_from_char(cBuf, 10);
     pStr->style |= SF_CENTER;
     pStr->fgcol = *get_game_colorRGB(COLOR_STD_CITY_LUX);
@@ -429,7 +429,7 @@
   
   /* ----------- */
     my_snprintf(cBuf, sizeof(cBuf), "%d",
-                       pCity->shield_prod + pCity->waste[O_SHIELD]);
+                       pCity->prod[O_SHIELD] + pCity->waste[O_SHIELD]);
     pStr = create_str16_from_char(cBuf, 10);
     pStr->style |= SF_CENTER;
     pStr->fgcol = *get_game_colorRGB(COLOR_STD_CITY_PROD);
@@ -457,7 +457,7 @@
   
     /* ----------- */
     my_snprintf(cBuf, sizeof(cBuf), "%d",
-         pCity->shield_prod + pCity->waste[O_SHIELD] - pCity->shield_surplus);
+         pCity->prod[O_SHIELD] + pCity->waste[O_SHIELD] - 
pCity->shield_surplus);
     pStr = create_str16_from_char(cBuf, 10);
     pStr->style |= SF_CENTER;
     pStr->fgcol = *get_game_colorRGB(COLOR_STD_CITY_SUPPORT);
@@ -932,7 +932,7 @@
   
   /* food consumptions */
   pWidget = pWidget->prev;
-  my_snprintf(cBuf, sizeof(cBuf), "%d", pCity->food_prod - 
pCity->food_surplus);
+  my_snprintf(cBuf, sizeof(cBuf), "%d", pCity->prod[O_FOOD] - 
pCity->food_surplus);
   copy_chars_to_string16(pWidget->string16, cBuf);
     
   /* food surplus */
@@ -974,23 +974,23 @@
             
   /* gold surplus */
   pWidget = pWidget->prev;
-  my_snprintf(cBuf, sizeof(cBuf), "%d", city_gold_surplus(pCity, 
pcity->tax_total));
+  my_snprintf(cBuf, sizeof(cBuf), "%d", city_gold_surplus(pCity, 
pcity->prod[O_GOLD]));
   copy_chars_to_string16(pWidget->string16, cBuf);
     
   /* science income */
   pWidget = pWidget->prev;
-  my_snprintf(cBuf, sizeof(cBuf), "%d", pCity->science_total);
+  my_snprintf(cBuf, sizeof(cBuf), "%d", pCity->prod[O_SCIENCE]);
   copy_chars_to_string16(pWidget->string16, cBuf);
     
   /* lugury income */
   pWidget = pWidget->prev;
-  my_snprintf(cBuf, sizeof(cBuf), "%d", pCity->luxury_total);
+  my_snprintf(cBuf, sizeof(cBuf), "%d", pCity->prod[O_LUXURY]);
   copy_chars_to_string16(pWidget->string16, cBuf);
   
   /* total production */
   pWidget = pWidget->prev;
   my_snprintf(cBuf, sizeof(cBuf), "%d",
-                       pCity->shield_prod + pCity->waste[O_SHIELD]);
+                       pCity->prod[O_SHIELD] + pCity->waste[O_SHIELD]);
   copy_chars_to_string16(pWidget->string16, cBuf);
   
   /* waste */
@@ -1001,7 +1001,7 @@
   /* units support */
   pWidget = pWidget->prev;
   my_snprintf(cBuf, sizeof(cBuf), "%d",
-         pCity->shield_prod + pCity->waste[O_SHIELD] - pCity->shield_surplus);
+         pCity->prod[O_SHIELD] + pCity->waste[O_SHIELD] - 
pCity->shield_surplus);
   copy_chars_to_string16(pWidget->string16, cBuf);
   
   /* production income */
Index: client/gui-sdl/repodlgs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/repodlgs.c,v
retrieving revision 1.40
diff -u -r1.40 repodlgs.c
--- client/gui-sdl/repodlgs.c   6 Dec 2004 18:01:14 -0000       1.40
+++ client/gui-sdl/repodlgs.c   9 Dec 2004 20:40:45 -0000
@@ -2515,7 +2515,7 @@
     /* ------------------------------------- */
 
     city_list_iterate(game.player_ptr->cities, pCity) {
-      curent_output += pCity->science_total;
+      curent_output += pCity->prod[O_SCIENCE];
     } city_list_iterate_end;
 
     if (curent_output <= 0) {
Index: client/gui-win32/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/citydlg.c,v
retrieving revision 1.87
diff -u -r1.87 citydlg.c
--- client/gui-win32/citydlg.c  9 Dec 2004 18:29:59 -0000       1.87
+++ client/gui-win32/citydlg.c  9 Dec 2004 20:40:45 -0000
@@ -442,8 +442,8 @@
   struct city *pcity=pdialog->pcity;
   my_snprintf(buf, sizeof(buf),
              _("Food:    %2d (%+2d)\nProd:    %2d (%+2d)\nTrade:   %2d 
(%+2d)"),
-             pcity->food_prod, pcity->surplus[O_FOOD],
-             pcity->shield_prod + pcity->waste[O_SHIELD],
+             pcity->prod[O_FOOD], pcity->surplus[O_FOOD],
+             pcity->prod[O_SHIELD] + pcity->waste[O_SHIELD],
              pcity->surplus[O_SHIELD],
              pcity->surplus[O_TRADE] + pcity->waste[O_TRADE],
              pcity->surplus[O_TRADE]);              
@@ -461,9 +461,9 @@
   struct city *pcity=pdialog->pcity;
   my_snprintf(buf, sizeof(buf),
              _("Gold:    %2d (%+2d)\nLuxury:  %2d\nScience: %2d"),
-             pcity->tax_total, city_gold_surplus(pcity, pcity->tax_total),
-             pcity->luxury_total,
-             pcity->science_total);      
+             pcity->prod[O_GOLD], city_gold_surplus(pcity, 
pcity->prod[O_GOLD]),
+             pcity->prod[O_LUXURY],
+             pcity->prod[O_SCIENCE]);      
   SetWindowText(pdialog->output_area[0],buf);
   SetWindowText(pdialog->output_area[1],buf);
 }
Index: client/gui-win32/happiness.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/happiness.c,v
retrieving revision 1.8
diff -u -r1.8 happiness.c
--- client/gui-win32/happiness.c        16 Jul 2004 19:37:57 -0000      1.8
+++ client/gui-win32/happiness.c        9 Dec 2004 20:40:45 -0000
@@ -218,7 +218,7 @@
   struct city *pcity = pdialog->pcity;
 
   my_snprintf(bptr, nleft, _("Luxury: %d total."),
-              pcity->luxury_total);
+              pcity->prod[O_LUXURY]);
 
   SetWindowText(pdialog->mod_label[LUXURIES], buf);
 }
Index: client/gui-xaw/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/citydlg.c,v
retrieving revision 1.125
diff -u -r1.125 citydlg.c
--- client/gui-xaw/citydlg.c    9 Dec 2004 18:29:59 -0000       1.125
+++ client/gui-xaw/citydlg.c    9 Dec 2004 20:40:45 -0000
@@ -239,9 +239,9 @@
 
   if (pdialog) {
     pcity=pdialog->pcity;
-    foodprod=pcity->food_prod;
+    foodprod=pcity->prod[O_FOOD];
     foodsurplus = pcity->surplus[O_FOOD];
-    shieldprod=pcity->shield_prod + pcity->waste[O_SHIELD];
+    shieldprod=pcity->prod[O_SHIELD] + pcity->waste[O_SHIELD];
     shieldsurplus = pcity->surplus[O_SHIELD];
     tradeprod = pcity->surplus[O_TRADE] + pcity->waste[O_TRADE];
     tradesurplus = pcity->surplus[O_TRADE];
@@ -270,10 +270,10 @@
 
   if (pdialog) {
     pcity=pdialog->pcity;
-    goldtotal=pcity->tax_total;
-    goldsurplus=city_gold_surplus(pcity, pcity->tax_total);
-    luxtotal=pcity->luxury_total;
-    scitotal=pcity->science_total;
+    goldtotal=pcity->prod[O_GOLD];
+    goldsurplus=city_gold_surplus(pcity, pcity->prod[O_GOLD]);
+    luxtotal=pcity->prod[O_LUXURY];
+    scitotal=pcity->prod[O_SCIENCE];
   }
 
   my_snprintf(retbuf, n, 
Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.277
diff -u -r1.277 city.c
--- common/city.c       9 Dec 2004 20:17:46 -0000       1.277
+++ common/city.c       9 Dec 2004 20:40:46 -0000
@@ -1746,17 +1746,17 @@
   int output[O_COUNT];
 
   memset(output, 0, O_COUNT * sizeof(*output));
-  pcity->luxury_total = 0;
-  pcity->science_total = 0;
-  pcity->tax_total = 0;
+  pcity->prod[O_LUXURY] = 0;
+  pcity->prod[O_SCIENCE] = 0;
+  pcity->prod[O_GOLD] = 0;
   output[O_TRADE] = pcity->surplus[O_TRADE];
   add_tax_income(city_owner(pcity), output);
   add_specialist_output(pcity, output);
-  pcity->luxury_total += output[O_LUXURY];
-  pcity->science_total += output[O_SCIENCE];
-  pcity->tax_total += output[O_GOLD];
+  pcity->prod[O_LUXURY] += output[O_LUXURY];
+  pcity->prod[O_SCIENCE] += output[O_SCIENCE];
+  pcity->prod[O_GOLD] += output[O_GOLD];
 
-  pcity->tax_total += get_city_tithes_bonus(pcity);
+  pcity->prod[O_GOLD] += get_city_tithes_bonus(pcity);
 }
 
 /**************************************************************************
@@ -1771,12 +1771,12 @@
     pcity->bonus[o] = get_city_output_bonus(pcity, o);
   } output_type_iterate_end;
 
-  pcity->shield_prod = (pcity->shield_prod * pcity->bonus[O_SHIELD]) / 100;
-  pcity->luxury_total = (pcity->luxury_total * pcity->bonus[O_LUXURY]) / 100;
-  pcity->tax_total = (pcity->tax_total * pcity->bonus[O_GOLD]) / 100;
-  pcity->science_total = (pcity->science_total
+  pcity->prod[O_SHIELD] = (pcity->prod[O_SHIELD] * pcity->bonus[O_SHIELD]) / 
100;
+  pcity->prod[O_LUXURY] = (pcity->prod[O_LUXURY] * pcity->bonus[O_LUXURY]) / 
100;
+  pcity->prod[O_GOLD] = (pcity->prod[O_GOLD] * pcity->bonus[O_GOLD]) / 100;
+  pcity->prod[O_SCIENCE] = (pcity->prod[O_SCIENCE]
                          * pcity->bonus[O_SCIENCE]) / 100;
-  pcity->surplus[O_SHIELD] = pcity->shield_prod;
+  pcity->surplus[O_SHIELD] = pcity->prod[O_SHIELD];
 }
 
 /**************************************************************************
@@ -1784,9 +1784,9 @@
 **************************************************************************/
 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);
+  pcity->surplus[O_SCIENCE] = pcity->prod[O_SCIENCE];
+  pcity->surplus[O_LUXURY] = pcity->prod[O_LUXURY];
+  pcity->surplus[O_GOLD] = city_gold_surplus(pcity, pcity->prod[O_GOLD]);
 }
 
 /**************************************************************************
@@ -1873,7 +1873,7 @@
 **************************************************************************/
 static inline void citizen_happy_luxury(struct city *pcity)
 {
-  int x = pcity->luxury_total;
+  int x = pcity->prod[O_LUXURY];
 
   happy_copy(pcity, 0);
 
@@ -1991,14 +1991,14 @@
 
     /* FIXME: These are special cases because many parts of the code still
      * check tax_total and science_total instead of the surplus[] array. */
-    pcity->tax_total = 0;
-    pcity->science_total = 0;
+    pcity->prod[O_GOLD] = 0;
+    pcity->prod[O_SCIENCE] = 0;
   }
 }
 
 /**************************************************************************
   Calculate pollution for the city.  The shield_total must be passed in
-  (most callers will want to pass pcity->shield_prod).
+  (most callers will want to pass pcity->prod[O_SHIELD]).
 **************************************************************************/
 int city_pollution(struct city *pcity, int shield_total)
 {
@@ -2035,12 +2035,12 @@
   pcity->surplus[O_SHIELD] = 0;
 
   get_worked_tile_output(pcity, output);
-  pcity->food_prod = output[O_FOOD];
-  pcity->shield_prod = output[O_SHIELD];
+  pcity->prod[O_FOOD] = output[O_FOOD];
+  pcity->prod[O_SHIELD] = output[O_SHIELD];
   pcity->surplus[O_TRADE] = output[O_TRADE];
   
   pcity->tile_trade = pcity->surplus[O_TRADE];
-  pcity->surplus[O_FOOD] = pcity->food_prod - pcity->size * 2;
+  pcity->surplus[O_FOOD] = pcity->prod[O_FOOD] - pcity->size * 2;
 
   for (i = 0; i < NUM_TRADEROUTES; i++) {
     pcity->trade_value[i] =
@@ -2049,9 +2049,10 @@
   }
   pcity->waste[O_TRADE] = city_waste(pcity, O_TRADE, pcity->surplus[O_TRADE]);
   pcity->surplus[O_TRADE] -= pcity->waste[O_TRADE];
+  pcity->prod[O_TRADE] = pcity->surplus[O_TRADE]; /* Set it here. */
 
-  pcity->waste[O_SHIELD] = city_waste(pcity, O_SHIELD, pcity->shield_prod);
-  pcity->shield_prod -= pcity->waste[O_SHIELD];
+  pcity->waste[O_SHIELD] = city_waste(pcity, O_SHIELD, pcity->prod[O_SHIELD]);
+  pcity->prod[O_SHIELD] -= pcity->waste[O_SHIELD];
 }
 
 /**************************************************************************
@@ -2201,7 +2202,7 @@
   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);
+  pcity->pollution = city_pollution(pcity, pcity->prod[O_SHIELD]);
   citizen_happy_luxury(pcity); /* with our new found luxuries */
   citizen_content_buildings(pcity);    /* temple cathedral colosseum */
   city_support(pcity, send_unit_info); /* manage settlers, and units */
Index: common/city.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.h,v
retrieving revision 1.179
diff -u -r1.179 city.h
--- common/city.h       9 Dec 2004 20:17:46 -0000       1.179
+++ common/city.h       9 Dec 2004 20:40:46 -0000
@@ -236,19 +236,14 @@
   /* the productions */
   int surplus[O_MAX]; /* Final surplus in each category. */
   int waste[O_MAX]; /* Waste/corruption in each category. */
+  int prod[O_MAX]; /* Production is total minus waste. */
 
-  int food_prod;
-
-  /* Shield production is shields produced minus shield_waste*/
-  int shield_prod;
+  /* tile_trade is a special case for trade routes. */
   int tile_trade;
 
   /* Cached values for CPU savings. */
   int bonus[O_MAX];
 
-  /* the totals */
-  int luxury_total, tax_total, science_total;
-  
   /* the physics */
   int food_stock;
   int shield_stock;
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.72
diff -u -r1.72 packets.def
--- common/packets.def  9 Dec 2004 18:29:59 -0000       1.72
+++ common/packets.def  9 Dec 2004 20:40:46 -0000
@@ -402,15 +402,13 @@
 
   SINT16 surplus[O_MAX];
   UINT16 waste[O_MAX];
-  UINT16 food_prod, shield_prod;
+  UINT16 prod[O_MAX];
   SINT16 tile_trade;
   UINT16 food_stock, shield_stock;
 
   UINT16 trade[NUM_TRADEROUTES];
   UINT8 trade_value[NUM_TRADEROUTES];
 
-  UINT16 luxury_total, tax_total, science_total;
-
   UINT16 pollution;
 
   UINT8 currently_building;
Index: common/player.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/player.c,v
retrieving revision 1.162
diff -u -r1.162 player.c
--- common/player.c     7 Dec 2004 18:01:12 -0000       1.162
+++ common/player.c     9 Dec 2004 20:40:46 -0000
@@ -390,7 +390,7 @@
   Return the expected net income of the player this turn.  This includes
   tax revenue and upkeep, but not one-time purchases or found gold.
 
-  This function depends on pcity->tax_total being set for all cities, so
+  This function depends on pcity->prod[O_GOLD] being set for all cities, so
   make sure the player's cities have been refreshed.
 **************************************************************************/
 int player_get_expected_income(const struct player *pplayer)
@@ -400,7 +400,7 @@
   /* City income/expenses. */
   city_list_iterate(pplayer->cities, pcity) {
     /* Gold suplus accounts for imcome plus building and unit upkeep. */
-    income += city_gold_surplus(pcity, pcity->tax_total);
+    income += city_gold_surplus(pcity, pcity->prod[O_GOLD]);
 
     /* Capitalization income. */
     if (get_current_construction_bonus(pcity, EFT_PROD_TO_GOLD) > 0) {
Index: common/aicore/cm.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/aicore/cm.c,v
retrieving revision 1.51
diff -u -r1.51 cm.c
--- common/aicore/cm.c  8 Dec 2004 04:28:26 -0000       1.51
+++ common/aicore/cm.c  9 Dec 2004 20:40:47 -0000
@@ -1530,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->surplus[O_FOOD];
+    usage[O_FOOD] = pcity->prod[O_FOOD] - pcity->surplus[O_FOOD];
   } else {
     usage[O_FOOD] = pcity->size * 2;
   }
@@ -1547,13 +1547,13 @@
    * 'factories' is the pcity->bonus[O_SHIELD]/100.  Increase it a bit to avoid
    * rounding errors.
    *
-   * pcity->shield_prod = (factories-waste) * production.
-   * Therefore, shield_usage = pcity->shield_prod - pcity->shield_surplus
+   * pcity->prod[O_SHIELD] = (factories-waste) * production.
+   * Therefore, shield_usage = pcity->prod[O_SHIELD] - pcity->shield_surplus
    */
   if (!city_unhappy(pcity)) {
     double sbonus;
 
-    usage[O_SHIELD] = pcity->shield_prod - pcity->surplus[O_SHIELD];
+    usage[O_SHIELD] = pcity->prod[O_SHIELD] - pcity->surplus[O_SHIELD];
 
     sbonus = ((double)pcity->bonus[O_SHIELD]) / 100.0;
     sbonus += .1;
@@ -2063,15 +2063,15 @@
   } my_city_map_iterate_end;
 
   freelog(LOG_NORMAL, "  food    = %3d (%+3d)",
-          pcity->food_prod, pcity->surplus[O_FOOD]);
+          pcity->prod[O_FOOD], pcity->surplus[O_FOOD]);
   freelog(LOG_NORMAL, "  shield  = %3d (%+3d)",
-          pcity->shield_prod, pcity->surplus[O_SHIELD]);
+          pcity->prod[O_SHIELD], 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));
-  freelog(LOG_NORMAL, "  luxury  = %3d", pcity->luxury_total);
-  freelog(LOG_NORMAL, "  science = %3d", pcity->science_total);
+  freelog(LOG_NORMAL, "  gold    = %3d (%+3d)", pcity->prod[O_GOLD],
+          city_gold_surplus(pcity, pcity->prod[O_GOLD]));
+  freelog(LOG_NORMAL, "  luxury  = %3d", pcity->prod[O_LUXURY]);
+  freelog(LOG_NORMAL, "  science = %3d", pcity->prod[O_SCIENCE]);
 }
 
 
Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.291
diff -u -r1.291 citytools.c
--- server/citytools.c  9 Dec 2004 18:30:00 -0000       1.291
+++ server/citytools.c  9 Dec 2004 20:40:48 -0000
@@ -1547,15 +1547,10 @@
   output_type_iterate(o) {
     packet->surplus[o] = pcity->surplus[o];
     packet->waste[o] = pcity->waste[o];
+    packet->prod[o] = pcity->prod[o];
   } output_type_iterate_end;
-  packet->food_prod = pcity->food_prod;
-  packet->shield_prod = pcity->shield_prod;
   packet->tile_trade = pcity->tile_trade;
 
-  packet->luxury_total=pcity->luxury_total;
-  packet->tax_total=pcity->tax_total;
-  packet->science_total=pcity->science_total;
-  
   packet->food_stock=pcity->food_stock;
   packet->shield_stock=pcity->shield_stock;
   packet->pollution=pcity->pollution;
Index: server/cityturn.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v
retrieving revision 1.284
diff -u -r1.284 cityturn.c
--- server/cityturn.c   9 Dec 2004 16:38:35 -0000       1.284
+++ server/cityturn.c   9 Dec 2004 20:40:48 -0000
@@ -1333,8 +1333,8 @@
     pcity->did_sell=FALSE;
     pcity->did_buy = FALSE;
     pcity->airlift = (get_city_bonus(pcity, EFT_AIRLIFT) > 0);
-    update_tech(pplayer, pcity->science_total);
-    pplayer->economic.gold+=pcity->tax_total;
+    update_tech(pplayer, pcity->prod[O_SCIENCE]);
+    pplayer->economic.gold+=pcity->prod[O_GOLD];
     pay_for_units(pplayer, pcity);
     pay_for_buildings(pplayer, pcity);
 
Index: server/gamelog.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/gamelog.c,v
retrieving revision 1.40
diff -u -r1.40 gamelog.c
--- server/gamelog.c    9 Dec 2004 16:38:35 -0000       1.40
+++ server/gamelog.c    9 Dec 2004 20:40:48 -0000
@@ -468,8 +468,8 @@
       } unit_list_iterate_end;
       city_list_iterate(pplayer->cities, pcity) {
         workers += pcity->size;
-        shields += pcity->shield_prod;
-        food += pcity->food_prod;
+        shields += pcity->prod[O_SHIELD];
+        food += pcity->prod[O_FOOD];
         trade += pcity->surplus[O_TRADE];
       } city_list_iterate_end;
 
Index: server/score.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/score.c,v
retrieving revision 1.12
diff -u -r1.12 score.c
--- server/score.c      30 Nov 2004 08:37:03 -0000      1.12
+++ server/score.c      9 Dec 2004 20:40:48 -0000
@@ -410,7 +410,7 @@
     pplayer->score.population += city_population(pcity);
     pplayer->score.cities++;
     pplayer->score.pollution += pcity->pollution;
-    pplayer->score.techout += pcity->science_total;
+    pplayer->score.techout += pcity->prod[O_SCIENCE];
     pplayer->score.bnp += pcity->surplus[O_TRADE];
     pplayer->score.mfg += pcity->surplus[O_SHIELD];
 
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.442
diff -u -r1.442 packhand.c
--- client/packhand.c   9 Dec 2004 18:29:58 -0000       1.442
+++ client/packhand.c   9 Dec 2004 20:41:43 -0000
@@ -455,19 +455,14 @@
     pcity->trade[i]=packet->trade[i];
     pcity->trade_value[i]=packet->trade_value[i];
   }
-  
-  pcity->food_prod=packet->food_prod;
+
   output_type_iterate(o) {
     pcity->surplus[o] = packet->surplus[o];
     pcity->waste[o] = packet->waste[o];
+    pcity->prod[o] = packet->prod[o];
   } output_type_iterate_end;
-  pcity->shield_prod=packet->shield_prod;
   pcity->tile_trade=packet->tile_trade;
 
-  pcity->luxury_total=packet->luxury_total;
-  pcity->tax_total=packet->tax_total;
-  pcity->science_total=packet->science_total;
-  
   pcity->food_stock=packet->food_stock;
   pcity->shield_stock=packet->shield_stock;
   pcity->pollution=packet->pollution;
@@ -745,13 +740,9 @@
       pcity->trade[i] = 0;
       pcity->trade_value[i] = 0;
     }
-    pcity->food_prod          = 0;
     memset(pcity->surplus, 0, O_COUNT * sizeof(*pcity->surplus));
-    pcity->shield_prod        = 0;
     memset(pcity->waste, 0, O_COUNT * sizeof(*pcity->waste));
-    pcity->luxury_total       = 0;
-    pcity->tax_total          = 0;
-    pcity->science_total      = 0;
+    memset(pcity->prod, 0, O_COUNT * sizeof(*pcity->prod));
     pcity->food_stock         = 0;
     pcity->shield_stock       = 0;
     pcity->pollution          = 0;
Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.277
diff -u -r1.277 city.c
--- common/city.c       9 Dec 2004 20:17:46 -0000       1.277
+++ common/city.c       9 Dec 2004 20:41:43 -0000
@@ -2049,6 +2049,7 @@
   }
   pcity->waste[O_TRADE] = city_waste(pcity, O_TRADE, pcity->surplus[O_TRADE]);
   pcity->surplus[O_TRADE] -= pcity->waste[O_TRADE];
+  pcity->prod[O_TRADE] = pcity->surplus[O_TRADE]; /* Set it here. */
 
   pcity->waste[O_SHIELD] = city_waste(pcity, O_SHIELD, pcity->shield_prod);
   pcity->shield_prod -= pcity->waste[O_SHIELD];
Index: common/city.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.h,v
retrieving revision 1.179
diff -u -r1.179 city.h
--- common/city.h       9 Dec 2004 20:17:46 -0000       1.179
+++ common/city.h       9 Dec 2004 20:41:43 -0000
@@ -236,19 +236,14 @@
   /* the productions */
   int surplus[O_MAX]; /* Final surplus in each category. */
   int waste[O_MAX]; /* Waste/corruption in each category. */
+  int prod[O_MAX]; /* Production is total minus waste. */
 
-  int food_prod;
-
-  /* Shield production is shields produced minus shield_waste*/
-  int shield_prod;
+  /* tile_trade is a special case for trade routes. */
   int tile_trade;
 
   /* Cached values for CPU savings. */
   int bonus[O_MAX];
 
-  /* the totals */
-  int luxury_total, tax_total, science_total;
-  
   /* the physics */
   int food_stock;
   int shield_stock;
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.72
diff -u -r1.72 packets.def
--- common/packets.def  9 Dec 2004 18:29:59 -0000       1.72
+++ common/packets.def  9 Dec 2004 20:41:44 -0000
@@ -402,15 +402,13 @@
 
   SINT16 surplus[O_MAX];
   UINT16 waste[O_MAX];
-  UINT16 food_prod, shield_prod;
+  UINT16 prod[O_MAX];
   SINT16 tile_trade;
   UINT16 food_stock, shield_stock;
 
   UINT16 trade[NUM_TRADEROUTES];
   UINT8 trade_value[NUM_TRADEROUTES];
 
-  UINT16 luxury_total, tax_total, science_total;
-
   UINT16 pollution;
 
   UINT8 currently_building;
Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.291
diff -u -r1.291 citytools.c
--- server/citytools.c  9 Dec 2004 18:30:00 -0000       1.291
+++ server/citytools.c  9 Dec 2004 20:41:45 -0000
@@ -1547,15 +1547,10 @@
   output_type_iterate(o) {
     packet->surplus[o] = pcity->surplus[o];
     packet->waste[o] = pcity->waste[o];
+    packet->prod[o] = pcity->prod[o];
   } output_type_iterate_end;
-  packet->food_prod = pcity->food_prod;
-  packet->shield_prod = pcity->shield_prod;
   packet->tile_trade = pcity->tile_trade;
 
-  packet->luxury_total=pcity->luxury_total;
-  packet->tax_total=pcity->tax_total;
-  packet->science_total=pcity->science_total;
-  
   packet->food_stock=pcity->food_stock;
   packet->shield_stock=pcity->shield_stock;
   packet->pollution=pcity->pollution;

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#11439) put city production in an array, Jason Short <=