Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2005:
[Freeciv-Dev] (PR#13474) a city_production struct
Home

[Freeciv-Dev] (PR#13474) a city_production struct

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13474) a city_production struct
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 14 Jul 2005 14:22:26 -0700
Reply-to: bugs@xxxxxxxxxxx

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

This patch changes pcity->is_building_unit and pcity->currently_building
into a separate struct.  The new values are pcity->production.is_unit
and pcity->production.value.

Reasons: the main reason is that this struct will be rather useful
elsewhere.  The cid and wid values the client uses should be replaced
with it.  Existing functions that take a
currently_building+is_building_unit values should instead take a
city_production struct.

Caveats: I considered using a union for the typedef, or using an enum
for is_unit (both like req_source does).  I decided against it for now
since there are only units and imprs and both are represented by
integers.  However at some point in the future this may change.

The patch is mostly search-and-replace:

s/is_building_unit/production.is_unit/
s/currently_building/production.value/

except for city.h (of course) and the network code
(packets.def/citytools.c/packhand.c).

-jason

? class.diff
? diff
? diff2
Index: ai/advdiplomacy.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdiplomacy.c,v
retrieving revision 1.82
diff -p -u -r1.82 advdiplomacy.c
--- ai/advdiplomacy.c   4 Jul 2005 17:48:35 -0000       1.82
+++ ai/advdiplomacy.c   14 Jul 2005 21:13:22 -0000
@@ -673,8 +673,8 @@ static int ai_war_desire(struct player *
    * while counting all enemy settlers as (worst case) indicators of
    * enemy expansionism */
   city_list_iterate(pplayer->cities, pcity) {
-    if (pcity->is_building_unit 
-        && unit_type_flag(pcity->currently_building, F_CITIES)) {
+    if (pcity->production.is_unit 
+        && unit_type_flag(pcity->production.value, F_CITIES)) {
       kill_desire -= 1;
     }
   } city_list_iterate_end;
Index: ai/advdomestic.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdomestic.c,v
retrieving revision 1.134
diff -p -u -r1.134 advdomestic.c
--- ai/advdomestic.c    9 Jul 2005 10:19:47 -0000       1.134
+++ ai/advdomestic.c    14 Jul 2005 21:13:22 -0000
@@ -68,8 +68,8 @@ static void ai_choose_help_wonder(struct
   if (pcity == wonder_city 
       || wonder_city == NULL
       || pcity->ai.distance_to_wonder_city <= 0
-      || wonder_city->is_building_unit
-      || !is_wonder(wonder_city->currently_building)) {
+      || wonder_city->production.is_unit
+      || !is_wonder(wonder_city->production.value)) {
     /* A distance of zero indicates we are very far away, possibly
      * on another continent. */
     return;
@@ -84,8 +84,8 @@ static void ai_choose_help_wonder(struct
 
   /* Count caravans being built */
   city_list_iterate(pplayer->cities, acity) {
-    if (acity->is_building_unit
-        && unit_type_flag(acity->currently_building, F_HELP_WONDER)
+    if (acity->production.is_unit
+        && unit_type_flag(acity->production.value, F_HELP_WONDER)
         && tile_get_continent(acity->tile) == continent) {
       caravans++;
     }
@@ -102,7 +102,7 @@ static void ai_choose_help_wonder(struct
   /* Check if wonder needs a little help. */
   if (build_points_left(wonder_city) 
       > unit_build_shield_cost(unit_type) * caravans) {
-    Impr_type_id wonder = wonder_city->currently_building;
+    Impr_type_id wonder = wonder_city->production.value;
     int want = wonder_city->ai.building_want[wonder];
     int dist = pcity->ai.distance_to_wonder_city /
                get_unit_type(unit_type)->move_rate;
Index: ai/aicity.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v
retrieving revision 1.230
diff -p -u -r1.230 aicity.c
--- ai/aicity.c 4 Jul 2005 17:48:35 -0000       1.230
+++ ai/aicity.c 14 Jul 2005 21:13:22 -0000
@@ -611,10 +611,10 @@ static void adjust_building_want_by_effe
   v -= pimpr->build_cost / (pcity->surplus[O_SHIELD] * 10 + 1);
 
   /* Would it mean losing shields? */
-  if ((pcity->is_building_unit 
-       || (is_wonder(pcity->currently_building) 
+  if ((pcity->production.is_unit 
+       || (is_wonder(pcity->production.value) 
            && !is_wonder(id))
-       || (!is_wonder(pcity->currently_building)
+       || (!is_wonder(pcity->production.value)
            && is_wonder(id)))
       && pcity->turn_last_built != game.info.turn) {
     v -= (pcity->shield_stock / 2) * (SHIELD_WEIGHTING / 2);
@@ -761,13 +761,13 @@ void ai_manage_buildings(struct player *
    * not check out, make a Wonder City. */
   if (!(wonder_city != NULL
         && wonder_city->surplus[O_SHIELD] > 0
-        && !wonder_city->is_building_unit
-        && is_wonder(wonder_city->currently_building)
+        && !wonder_city->production.is_unit
+        && is_wonder(wonder_city->production.value)
         && can_build_improvement(wonder_city, 
-                                 wonder_city->currently_building)
-        && !improvement_obsolete(pplayer, wonder_city->currently_building)
+                                 wonder_city->production.value)
+        && !improvement_obsolete(pplayer, wonder_city->production.value)
         && !is_building_replaced(wonder_city, 
-                                 wonder_city->currently_building))
+                                 wonder_city->production.value))
       || wonder_city == NULL) {
     /* Find a new wonder city! */
     int best_candidate_value = 0;
@@ -961,19 +961,19 @@ static void ai_city_choose_build(struct 
              get_improvement_name(pcity->ai.choice.choice)),
             pcity->ai.choice.want);
     
-    if (!pcity->is_building_unit && is_great_wonder(pcity->currently_building) 
+    if (!pcity->production.is_unit && is_great_wonder(pcity->production.value) 
        && (is_unit_choice_type(pcity->ai.choice.type) 
-           || pcity->ai.choice.choice != pcity->currently_building))
+           || pcity->ai.choice.choice != pcity->production.value))
       notify_player_ex(NULL, pcity->tile, E_WONDER_STOPPED,
                       _("The %s have stopped building The %s in %s."),
                       get_nation_name_plural(pplayer->nation),
-                      get_impr_name_ex(pcity, pcity->currently_building),
+                      get_impr_name_ex(pcity, pcity->production.value),
                       pcity->name);
     
     if (pcity->ai.choice.type == CT_BUILDING 
        && is_wonder(pcity->ai.choice.choice)
-       && (pcity->is_building_unit 
-           || pcity->currently_building != pcity->ai.choice.choice)) {
+       && (pcity->production.is_unit 
+           || pcity->production.value != pcity->ai.choice.choice)) {
       if (is_great_wonder(pcity->ai.choice.choice)) {
        notify_player_ex(NULL, pcity->tile, E_WONDER_STARTED,
                         _("The %s have started building The %s in %s."),
@@ -981,11 +981,11 @@ static void ai_city_choose_build(struct 
                         get_impr_name_ex(pcity, pcity->ai.choice.choice),
                         pcity->name);
       }
-      pcity->currently_building = pcity->ai.choice.choice;
-      pcity->is_building_unit = is_unit_choice_type(pcity->ai.choice.type);
+      pcity->production.value = pcity->ai.choice.choice;
+      pcity->production.is_unit = is_unit_choice_type(pcity->ai.choice.type);
     } else {
-      pcity->currently_building = pcity->ai.choice.choice;
-      pcity->is_building_unit   = is_unit_choice_type(pcity->ai.choice.type);
+      pcity->production.value = pcity->ai.choice.choice;
+      pcity->production.is_unit   = is_unit_choice_type(pcity->ai.choice.type);
     }
   }
 }
Index: ai/aiferry.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aiferry.c,v
retrieving revision 1.22
diff -p -u -r1.22 aiferry.c
--- ai/aiferry.c        7 May 2005 13:35:24 -0000       1.22
+++ ai/aiferry.c        14 Jul 2005 21:13:24 -0000
@@ -769,17 +769,17 @@ static bool aiferry_find_interested_city
     
     if (pcity && pcity->owner == pferry->owner
         && (pcity->ai.choice.need_boat 
-            || (pcity->is_building_unit
-               && unit_has_role(pcity->currently_building, L_FERRYBOAT)))) {
+            || (pcity->production.is_unit
+               && unit_has_role(pcity->production.value, L_FERRYBOAT)))) {
       bool really_needed = TRUE;
-      int turns = city_turns_to_build(pcity, pcity->currently_building,
-                                      pcity->is_building_unit, TRUE);
+      int turns = city_turns_to_build(pcity, pcity->production.value,
+                                      pcity->production.is_unit, TRUE);
 
       UNIT_LOG(LOGLEVEL_FERRY, pferry, "%s (%d, %d) looks promising...", 
                pcity->name, TILE_XY(pcity->tile));
 
-      if (pos.turn > turns && pcity->is_building_unit
-          && unit_has_role(pcity->currently_building, L_FERRYBOAT)) {
+      if (pos.turn > turns && pcity->production.is_unit
+          && unit_has_role(pcity->production.value, L_FERRYBOAT)) {
         UNIT_LOG(LOGLEVEL_FERRY, pferry, "%s is NOT suitable: "
                  "will finish building its own ferry too soon", pcity->name);
         continue;
Index: client/citydlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/citydlg_common.c,v
retrieving revision 1.81
diff -p -u -r1.81 citydlg_common.c
--- client/citydlg_common.c     4 Jul 2005 17:48:36 -0000       1.81
+++ client/citydlg_common.c     14 Jul 2005 21:13:24 -0000
@@ -214,14 +214,14 @@ void get_city_dialog_production(struct c
     return;
   }
 
-  turns = city_turns_to_build(pcity, pcity->currently_building,
-                             pcity->is_building_unit, TRUE);
+  turns = city_turns_to_build(pcity, pcity->production.value,
+                             pcity->production.is_unit, TRUE);
   stock = pcity->shield_stock;
 
-  if (pcity->is_building_unit) {
-    cost = unit_build_shield_cost(pcity->currently_building);
+  if (pcity->production.is_unit) {
+    cost = unit_build_shield_cost(pcity->production.value);
   } else {
-    cost = impr_build_shield_cost(pcity->currently_building);
+    cost = impr_build_shield_cost(pcity->production.value);
   }
 
   if (get_current_construction_bonus(pcity, EFT_PROD_TO_GOLD) > 0) {
@@ -645,8 +645,8 @@ static bool base_city_queue_insert(struc
       return FALSE;
     }
 
-    old_id = pcity->currently_building;
-    old_is_unit = pcity->is_building_unit;
+    old_id = pcity->production.value;
+    old_is_unit = pcity->production.is_unit;
     if (!worklist_insert(&pcity->worklist, old_id, old_is_unit, 0)) {
       return FALSE;
     }
@@ -762,8 +762,8 @@ void city_get_queue(struct city *pcity, 
   /* We want the current production to be in the queue. Always. */
   worklist_remove(pqueue, MAX_LEN_WORKLIST - 1);
 
-  id = pcity->currently_building;
-  is_unit = pcity->is_building_unit;
+  id = pcity->production.value;
+  is_unit = pcity->production.is_unit;
   worklist_insert(pqueue, id, is_unit, 0);
 }
 
@@ -810,7 +810,7 @@ bool city_can_buy(const struct city *pci
          && pcity->turn_founded != game.info.turn
          && !pcity->did_buy
          && get_current_construction_bonus(pcity, EFT_PROD_TO_GOLD) <= 0
-         && !(pcity->is_building_unit && pcity->anarchy != 0)
+         && !(pcity->production.is_unit && pcity->anarchy != 0)
          && city_buy_cost(pcity) > 0);
 }
 
Index: client/cityrepdata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/cityrepdata.c,v
retrieving revision 1.51
diff -p -u -r1.51 cityrepdata.c
--- client/cityrepdata.c        10 May 2005 17:01:23 -0000      1.51
+++ client/cityrepdata.c        14 Jul 2005 21:13:24 -0000
@@ -360,11 +360,11 @@ static const char *cr_entry_building(con
        
   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),
+               get_impr_name_ex(pcity, pcity->production.value),
                MAX(0, pcity->surplus[O_SHIELD]), from_worklist);
   } else {
-    int turns = city_turns_to_build(pcity, pcity->currently_building,
-                                   pcity->is_building_unit, TRUE);
+    int turns = city_turns_to_build(pcity, pcity->production.value,
+                                   pcity->production.is_unit, TRUE);
     char time[32];
     const char *name;
     int cost;
@@ -375,12 +375,12 @@ static const char *cr_entry_building(con
       my_snprintf(time, sizeof(time), "-");
     }
 
-    if(pcity->is_building_unit) {
-      name = get_unit_type(pcity->currently_building)->name;
-      cost = unit_build_shield_cost(pcity->currently_building);
+    if(pcity->production.is_unit) {
+      name = get_unit_type(pcity->production.value)->name;
+      cost = unit_build_shield_cost(pcity->production.value);
     } else {
-      name = get_impr_name_ex(pcity, pcity->currently_building);
-      cost = impr_build_shield_cost(pcity->currently_building);
+      name = get_impr_name_ex(pcity, pcity->production.value);
+      cost = impr_build_shield_cost(pcity->production.value);
     }
 
     my_snprintf(buf, sizeof(buf), "%s (%d/%d/%s/%d)%s", name,
Index: client/climisc.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/climisc.c,v
retrieving revision 1.169
diff -p -u -r1.169 climisc.c
--- client/climisc.c    4 Jul 2005 17:48:36 -0000       1.169
+++ client/climisc.c    14 Jul 2005 21:13:24 -0000
@@ -174,11 +174,11 @@ void client_change_all(cid x, cid y)
   connection_do_buffer(&aconnection);
   city_list_iterate (game.player_ptr->cities, pcity) {
     if (((fr_is_unit &&
-         (pcity->is_building_unit) &&
-         (pcity->currently_building == fr_id)) ||
+         (pcity->production.is_unit) &&
+         (pcity->production.value == fr_id)) ||
         (!fr_is_unit &&
-         !(pcity->is_building_unit) &&
-         (pcity->currently_building == fr_id))) &&
+         !(pcity->production.is_unit) &&
+         (pcity->production.value == fr_id))) &&
        ((to_is_unit &&
          can_build_unit (pcity, to_id)) ||
         (!to_is_unit &&
@@ -455,7 +455,7 @@ cid cid_encode(bool is_unit, int id)
 **************************************************************************/
 cid cid_encode_from_city(struct city * pcity)
 {
-  return cid_encode(pcity->is_building_unit, pcity->currently_building);
+  return cid_encode(pcity->production.is_unit, pcity->production.value);
 }
 
 /**************************************************************************
@@ -1072,10 +1072,10 @@ void cityrep_buy(struct city *pcity)
   if (get_current_construction_bonus(pcity, EFT_PROD_TO_GOLD) > 0) {
     char buf[512];
 
-    assert(!pcity->is_building_unit);
+    assert(!pcity->production.is_unit);
     my_snprintf(buf, sizeof(buf),
                _("You don't buy %s in %s!"),
-               improvement_types[pcity->currently_building].name,
+               improvement_types[pcity->production.value].name,
                pcity->name);
     append_output_window(buf);
     return;
@@ -1087,10 +1087,10 @@ void cityrep_buy(struct city *pcity)
     char buf[512];
     const char *name;
 
-    if (pcity->is_building_unit) {
-      name = get_unit_type(pcity->currently_building)->name;
+    if (pcity->production.is_unit) {
+      name = get_unit_type(pcity->production.value)->name;
     } else {
-      name = get_impr_name_ex(pcity, pcity->currently_building);
+      name = get_impr_name_ex(pcity, pcity->production.value);
     }
 
     my_snprintf(buf, sizeof(buf),
Index: client/mapctrl_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapctrl_common.c,v
retrieving revision 1.56
diff -p -u -r1.56 mapctrl_common.c
--- client/mapctrl_common.c     4 Jul 2005 17:48:36 -0000       1.56
+++ client/mapctrl_common.c     14 Jul 2005 21:13:24 -0000
@@ -330,8 +330,8 @@ void clipboard_copy_production(struct ti
     if (pcity->owner != game.player_ptr)  {
       return;
     }
-    clipboard = pcity->currently_building;
-    clipboard_is_unit = pcity->is_building_unit;
+    clipboard = pcity->production.value;
+    clipboard_is_unit = pcity->production.is_unit;
   } else {
     struct unit *punit = find_visible_unit(ptile);
     if (!punit) {
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.240
diff -p -u -r1.240 mapview_common.c
--- client/mapview_common.c     4 Jul 2005 17:48:36 -0000       1.240
+++ client/mapview_common.c     14 Jul 2005 21:13:25 -0000
@@ -1888,12 +1888,12 @@ struct city *find_city_near_tile(const s
 void get_city_mapview_production(struct city *pcity,
                                  char *buffer, size_t buffer_len)
 {
-  int turns = city_turns_to_build(pcity, pcity->currently_building,
-                                 pcity->is_building_unit, TRUE);
+  int turns = city_turns_to_build(pcity, pcity->production.value,
+                                 pcity->production.is_unit, TRUE);
                                
-  if (pcity->is_building_unit) {
+  if (pcity->production.is_unit) {
     struct unit_type *punit_type =
-               get_unit_type(pcity->currently_building);
+               get_unit_type(pcity->production.value);
     if (turns < 999) {
       my_snprintf(buffer, buffer_len, "%s %d",
                   punit_type->name, turns);
@@ -1903,7 +1903,7 @@ void get_city_mapview_production(struct 
     }
   } else {
     struct impr_type *pimprovement_type =
-               get_improvement_type(pcity->currently_building);
+               get_improvement_type(pcity->production.value);
     if (get_current_construction_bonus(pcity, EFT_PROD_TO_GOLD) > 0) {
       my_snprintf(buffer, buffer_len, "%s", pimprovement_type->name);
     } else if (turns < 999) {
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.531
diff -p -u -r1.531 packhand.c
--- client/packhand.c   14 Jul 2005 19:25:44 -0000      1.531
+++ client/packhand.c   14 Jul 2005 21:13:25 -0000
@@ -407,8 +407,8 @@ void handle_city_info(struct packet_city
     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->production.is_unit != packet->production_is_unit
+                  || pcity->production.value != packet->production_value
                   || pcity->surplus[O_SHIELD] != packet->surplus[O_SHIELD]
                   || pcity->shield_stock != packet->shield_stock)) {
       update_descriptions = TRUE;
@@ -458,12 +458,12 @@ void handle_city_info(struct packet_city
   pcity->pollution=packet->pollution;
 
   if (city_is_new
-      || pcity->is_building_unit != packet->is_building_unit
-      || pcity->currently_building != packet->currently_building) {
+      || pcity->production.is_unit != packet->production_is_unit
+      || pcity->production.value != packet->production_value) {
     need_units_dialog_update = TRUE;
   }
-  pcity->is_building_unit=packet->is_building_unit;
-  pcity->currently_building=packet->currently_building;
+  pcity->production.is_unit = packet->production_is_unit;
+  pcity->production.value = packet->production_value;
   if (city_is_new) {
     init_worklist(&pcity->worklist);
 
@@ -716,8 +716,8 @@ void handle_city_short_info(struct packe
     pcity->shield_stock       = 0;
     pcity->pollution          = 0;
     pcity->city_options       = 0;
-    pcity->is_building_unit   = FALSE;
-    pcity->currently_building = 0;
+    pcity->production.is_unit = FALSE;
+    pcity->production.value = 0;
     init_worklist(&pcity->worklist);
     pcity->airlift            = FALSE;
     pcity->did_buy            = FALSE;
Index: client/agents/cma_fec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/agents/cma_fec.c,v
retrieving revision 1.31
diff -p -u -r1.31 cma_fec.c
--- client/agents/cma_fec.c     7 Feb 2005 08:14:48 -0000       1.31
+++ client/agents/cma_fec.c     14 Jul 2005 21:13:25 -0000
@@ -285,15 +285,15 @@ static const char *get_prod_complete_str
   }
 
   stock = pcity->shield_stock;
-  if (pcity->is_building_unit) {
-    cost = unit_build_shield_cost(pcity->currently_building);
+  if (pcity->production.is_unit) {
+    cost = unit_build_shield_cost(pcity->production.value);
   } else {
     if (get_current_construction_bonus(pcity, EFT_PROD_TO_GOLD) > 0) {
       my_snprintf(buffer, sizeof(buffer),
-                 get_improvement_type(pcity->currently_building)->name);
+                 get_improvement_type(pcity->production.value)->name);
       return buffer;
     }
-    cost = impr_build_shield_cost(pcity->currently_building);
+    cost = impr_build_shield_cost(pcity->production.value);
   }
 
   stock += surplus;
Index: client/gui-ftwl/gui_text.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-ftwl/gui_text.c,v
retrieving revision 1.13
diff -p -u -r1.13 gui_text.c
--- client/gui-ftwl/gui_text.c  9 Jul 2005 17:46:07 -0000       1.13
+++ client/gui-ftwl/gui_text.c  14 Jul 2005 21:13:25 -0000
@@ -336,18 +336,18 @@ const char *mapview_get_city_action_tool
   if (strcmp(action, "city_buy") == 0) {
     const char *name;
 
-    if (pcity->is_building_unit) {
-      name = get_unit_type(pcity->currently_building)->name;
+    if (pcity->production.is_unit) {
+      name = get_unit_type(pcity->production.value)->name;
     } else {
-      name = get_impr_name_ex(pcity, pcity->currently_building);
+      name = get_impr_name_ex(pcity, pcity->production.value);
     }
 
     add_line(_("Buy production"));
     add_line(_("Cost: %d (%d in treasury)"),
             city_buy_cost(pcity), game.player_ptr->economic.gold);
     add_line(_("Producting: %s (%d turns)"), name,
-            city_turns_to_build(pcity, pcity->currently_building,
-                                pcity->is_building_unit, TRUE));
+            city_turns_to_build(pcity, pcity->production.value,
+                                pcity->production.is_unit, TRUE));
   } else {
     add_line("tooltip for action %s isn't written yet", action);
     freelog(LOG_NORMAL,
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.130
diff -p -u -r1.130 citydlg.c
--- client/gui-gtk-2.0/citydlg.c        4 Jul 2005 17:48:36 -0000       1.130
+++ client/gui-gtk-2.0/citydlg.c        14 Jul 2005 21:13:26 -0000
@@ -1515,12 +1515,12 @@ static void city_dialog_update_building(
 
   get_city_dialog_production(pcity, buf, sizeof(buf));
 
-  if (pcity->is_building_unit) {
-    cost = unit_build_shield_cost(pcity->currently_building);
-    descr = get_unit_type(pcity->currently_building)->name;
+  if (pcity->production.is_unit) {
+    cost = unit_build_shield_cost(pcity->production.value);
+    descr = get_unit_type(pcity->production.value)->name;
   } else {
-    cost = impr_build_shield_cost(pcity->currently_building);;
-    descr = get_impr_name_ex(pcity, pcity->currently_building);
+    cost = impr_build_shield_cost(pcity->production.value);;
+    descr = get_impr_name_ex(pcity, pcity->production.value);
   }
 
   if (cost > 0) {
@@ -2426,12 +2426,12 @@ static void buy_callback(GtkWidget *w, g
 
   pdialog = (struct city_dialog *) data;
 
-  if (pdialog->pcity->is_building_unit) {
-    name = get_unit_type(pdialog->pcity->currently_building)->name;
+  if (pdialog->pcity->production.is_unit) {
+    name = get_unit_type(pdialog->pcity->production.value)->name;
   } else {
     name =
        get_impr_name_ex(pdialog->pcity,
-                        pdialog->pcity->currently_building);
+                        pdialog->pcity->production.value);
   }
   value = city_buy_cost(pdialog->pcity);
 
Index: client/gui-gtk-2.0/cityrep.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/cityrep.c,v
retrieving revision 1.73
diff -p -u -r1.73 cityrep.c
--- client/gui-gtk-2.0/cityrep.c        23 Apr 2005 17:40:23 -0000      1.73
+++ client/gui-gtk-2.0/cityrep.c        14 Jul 2005 21:13:26 -0000
@@ -975,11 +975,11 @@ static void city_select_building_callbac
     itree_get(&it, 0, &res, -1);
     pcity = res;
 
-    if ( (which == TYPE_UNIT && pcity->is_building_unit)
-         || (which == TYPE_NORMAL_IMPROVEMENT && !pcity->is_building_unit
-             && !is_wonder(pcity->currently_building))
-         || (which == TYPE_WONDER && !pcity->is_building_unit
-             && is_wonder(pcity->currently_building)) ) {
+    if ( (which == TYPE_UNIT && pcity->production.is_unit)
+         || (which == TYPE_NORMAL_IMPROVEMENT && !pcity->production.is_unit
+             && !is_wonder(pcity->production.value))
+         || (which == TYPE_WONDER && !pcity->production.is_unit
+             && is_wonder(pcity->production.value)) ) {
       itree_select(city_selection, &it);
     }
   }
Index: client/gui-gtk-2.0/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/dialogs.c,v
retrieving revision 1.111
diff -p -u -r1.111 dialogs.c
--- client/gui-gtk-2.0/dialogs.c        13 Jul 2005 15:29:13 -0000      1.111
+++ client/gui-gtk-2.0/dialogs.c        14 Jul 2005 21:13:26 -0000
@@ -966,7 +966,7 @@ void popup_caravan_dialog(struct unit *p
 
   if (unit_can_help_build_wonder(punit, pdestcity)) {
     my_snprintf(wonder, sizeof(wonder), _("Help build _Wonder (%d remaining)"),
-       impr_build_shield_cost(pdestcity->currently_building)
+       impr_build_shield_cost(pdestcity->production.value)
        - pdestcity->shield_stock);
     can_wonder = TRUE;
   } else {
Index: client/gui-gtk-2.0/repodlgs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/repodlgs.c,v
retrieving revision 1.91
diff -p -u -r1.91 repodlgs.c
--- client/gui-gtk-2.0/repodlgs.c       30 Jun 2005 20:18:37 -0000      1.91
+++ client/gui-gtk-2.0/repodlgs.c       14 Jul 2005 21:13:27 -0000
@@ -1214,8 +1214,8 @@ void activeunits_report_dialog_update(vo
       }
     } unit_list_iterate_end;
     city_list_iterate(game.player_ptr->cities,pcity) {
-      if (pcity->is_building_unit) {
-       (unitarray[pcity->currently_building].building_count)++;
+      if (pcity->production.is_unit) {
+       (unitarray[pcity->production.value].building_count)++;
       }
     }
     city_list_iterate_end;
Index: client/gui-mui/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/citydlg.c,v
retrieving revision 1.95
diff -p -u -r1.95 citydlg.c
--- client/gui-mui/citydlg.c    5 May 2005 18:32:47 -0000       1.95
+++ client/gui-mui/citydlg.c    14 Jul 2005 21:13:27 -0000
@@ -142,15 +142,15 @@ static const char *const get_prod_comple
   }
 
   stock = pcity->shield_stock;
-  if (pcity->is_building_unit) {
-    cost = unit_build_shield_cost(pcity->currently_building);
+  if (pcity->production.is_unit) {
+    cost = unit_build_shield_cost(pcity->production.value);
   } else {
-    if (pcity->currently_building == B_CAPITAL) {
+    if (pcity->production.value == B_CAPITAL) {
       my_snprintf(buffer, sizeof(buffer),
-                 get_improvement_type(pcity->currently_building)->name);
+                 get_improvement_type(pcity->production.value)->name);
       return buffer;
     }
-    cost = impr_build_shield_cost(pcity->currently_building);
+    cost = impr_build_shield_cost(pcity->production.value);
   }
 
   stock += surplus;
@@ -827,8 +827,8 @@ static void commit_city_worklist(struct 
     if (!worklist_peek_ith(pwl, &id, &is_unit, k))
       break;
 
-    same_as_current_build = id == pdialog->pcity->currently_building
-       && is_unit == pdialog->pcity->is_building_unit;
+    same_as_current_build = id == pdialog->pcity->production.value
+       && is_unit == pdialog->pcity->production.is_unit;
 
     /* Very special case: If we are currently building a wonder we
        allow the construction to continue, even if we the wonder is
@@ -944,13 +944,13 @@ static void city_buy(struct city_dialog 
   char *name;
   char buf[512];
 
-  if (pdialog->pcity->is_building_unit)
+  if (pdialog->pcity->production.is_unit)
   {
-    name = get_unit_type(pdialog->pcity->currently_building)->name;
+    name = get_unit_type(pdialog->pcity->production.value)->name;
   }
   else
   {
-    name = get_impr_name_ex(pdialog->pcity, 
pdialog->pcity->currently_building);
+    name = get_impr_name_ex(pdialog->pcity, pdialog->pcity->production.value);
   }
 
   value = city_buy_cost(pdialog->pcity);
@@ -1266,7 +1266,7 @@ void popup_city_production_dialog(struct
 
         DoMethod(pcprod->available_listview, MUIM_NList_InsertSingle, i + 1, 
MUIV_NList_Insert_Bottom);
 
-        if (i == pcity->currently_building && !pcity->is_building_unit)
+        if (i == pcity->production.value && !pcity->production.is_unit)
          current = pos++;
 
         pos++;
@@ -1286,7 +1286,7 @@ void popup_city_production_dialog(struct
       {
         DoMethod(pcprod->available_listview, MUIM_NList_InsertSingle, i + 
10000, MUIV_NList_Insert_Bottom);
 
-        if(i == pcity->currently_building && pcity->is_building_unit)
+        if(i == pcity->production.value && pcity->production.is_unit)
          current = pos++;
 
         pos++;
@@ -1762,12 +1762,12 @@ static void city_dialog_update_building(
   get_city_dialog_production(pcity, buf, sizeof(buf));
 
   shield = pcity->shield_stock;
-  if (pcity->is_building_unit) {
-    max_shield = unit_build_shield_cost(pcity->currently_building);
-    descr = get_unit_type(pcity->currently_building)->name;
+  if (pcity->production.is_unit) {
+    max_shield = unit_build_shield_cost(pcity->production.value);
+    descr = get_unit_type(pcity->production.value)->name;
   } else {
-    max_shield = impr_build_shield_cost(pcity->currently_building);
-    descr = get_impr_name_ex(pcity, pcity->currently_building);
+    max_shield = impr_build_shield_cost(pcity->production.value);
+    descr = get_impr_name_ex(pcity, pcity->production.value);
   }
 
   if (!worklist_is_empty(&pcity->worklist)) {
Index: client/gui-mui/repodlgs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/repodlgs.c,v
retrieving revision 1.39
diff -p -u -r1.39 repodlgs.c
--- client/gui-mui/repodlgs.c   5 May 2005 18:32:48 -0000       1.39
+++ client/gui-mui/repodlgs.c   14 Jul 2005 21:13:27 -0000
@@ -820,8 +820,8 @@ void activeunits_report_dialog_update(vo
 
   city_list_iterate(game.player_ptr->cities, pcity)
   {
-    if (pcity->is_building_unit) {
-      (unitarray[pcity->currently_building].building_count)++;
+    if (pcity->production.is_unit) {
+      (unitarray[pcity->production.value].building_count)++;
     }
   }
   city_list_iterate_end;
Index: client/gui-mui/worklistclass.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/worklistclass.c,v
retrieving revision 1.26
diff -p -u -r1.26 worklistclass.c
--- client/gui-mui/worklistclass.c      25 Feb 2004 20:09:51 -0000      1.26
+++ client/gui-mui/worklistclass.c      14 Jul 2005 21:13:27 -0000
@@ -610,7 +610,7 @@ static void worklist_list_update(struct 
   if (data->embedded_in_city && data->pcity)
   {
      entry.type = 0;
-     entry.wid = wid_encode(data->pcity->is_building_unit, FALSE, 
data->pcity->currently_building);
+     entry.wid = wid_encode(data->pcity->production.is_unit, FALSE, 
data->pcity->production.value);
      DoMethod(data->current_listview, MUIM_NList_InsertSingle, &entry, 
MUIV_NList_Insert_Bottom);
   }
 
Index: client/gui-sdl/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/citydlg.c,v
retrieving revision 1.54
diff -p -u -r1.54 citydlg.c
--- client/gui-sdl/citydlg.c    2 May 2005 15:42:52 -0000       1.54
+++ client/gui-sdl/citydlg.c    14 Jul 2005 21:13:28 -0000
@@ -1193,10 +1193,10 @@ void popup_hurry_production_dialog(struc
   
   pHurry_Prod_Dlg = MALLOC(sizeof(struct SMALL_DLG));
   
-  if (pCity->is_building_unit) {
-    name = get_unit_type(pCity->currently_building)->name;
+  if (pCity->production.is_unit) {
+    name = get_unit_type(pCity->production.value)->name;
   } else {
-    name = get_impr_name_ex(pCity, pCity->currently_building);
+    name = get_impr_name_ex(pCity, pCity->production.value);
   }
 
   value = city_buy_cost(pCity);
@@ -3349,9 +3349,9 @@ static void redraw_city_dialog(struct ci
   /* ================================================================= */
 
   /* draw productions shields progress */
-  if (pCity->is_building_unit) {
-    struct unit_type *pUnit = get_unit_type(pCity->currently_building);
-    cost = unit_build_shield_cost(pCity->currently_building);
+  if (pCity->production.is_unit) {
+    struct unit_type *pUnit = get_unit_type(pCity->production.value);
+    cost = unit_build_shield_cost(pCity->production.value);
     count = cost / 10;
         
     copy_chars_to_string16(pStr, pUnit->name);
@@ -3370,9 +3370,9 @@ static void redraw_city_dialog(struct ci
 
   } else {
     struct impr_type *pImpr =
-       get_improvement_type(pCity->currently_building);
+       get_improvement_type(pCity->production.value);
 
-    if (pCity->currently_building == B_CAPITAL) {
+    if (pCity->production.value == B_CAPITAL) {
 
       if (pCityDlg->pBuy_Button
         && get_wstate(pCityDlg->pBuy_Button) != FC_WS_DISABLED) {
@@ -3391,7 +3391,7 @@ static void redraw_city_dialog(struct ci
        redraw_widget(pCityDlg->pBuy_Button);
       }
 
-      cost = impr_build_shield_cost(pCity->currently_building);
+      cost = impr_build_shield_cost(pCity->production.value);
       count = cost / 10;
       
     }
@@ -3441,7 +3441,7 @@ static void redraw_city_dialog(struct ci
     
     if (pCity->shield_stock < cost) {
       count = city_turns_to_build(pCity,
-       pCity->currently_building, pCity->is_building_unit, TRUE);
+       pCity->production.value, pCity->production.is_unit, TRUE);
       if (count == 999) {
         my_snprintf(cBuf, sizeof(cBuf), "(%d/%d) %s!",
                                pCity->shield_stock, cost,  _("blocked"));
Index: client/gui-sdl/cityrep.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/cityrep.c,v
retrieving revision 1.18
diff -p -u -r1.18 cityrep.c
--- client/gui-sdl/cityrep.c    13 Dec 2004 16:23:29 -0000      1.18
+++ client/gui-sdl/cityrep.c    14 Jul 2005 21:13:28 -0000
@@ -485,17 +485,17 @@ static void real_info_city_report_dialog
     add_to_gui_list(MAX_ID - pCity->id, pBuf);
 
     /* ----------- */
-    if(pCity->is_building_unit) {
-      struct unit_type *pUnit = get_unit_type(pCity->currently_building);
+    if(pCity->production.is_unit) {
+      struct unit_type *pUnit = get_unit_type(pCity->production.value);
       pLogo = ResizeSurface(GET_SURF(pUnit->sprite), 36, 24, 1);
       SDL_SetColorKey(pLogo,
          SDL_SRCCOLORKEY|SDL_RLEACCEL, get_first_pixel(pLogo));
-      togrow = unit_build_shield_cost(pCity->currently_building);
+      togrow = unit_build_shield_cost(pCity->production.value);
       pName = pUnit->name;
     } else {
-      struct impr_type *pImprv = 
get_improvement_type(pCity->currently_building);
+      struct impr_type *pImprv = get_improvement_type(pCity->production.value);
       pLogo = ResizeSurface(GET_SURF(pImprv->sprite), 36, 24, 1);
-      togrow = impr_build_shield_cost(pCity->currently_building);
+      togrow = impr_build_shield_cost(pCity->production.value);
       pName = pImprv->name;
     }
     
@@ -518,7 +518,7 @@ static void real_info_city_report_dialog
     pStr->style |= SF_CENTER;
     
     togrow = city_turns_to_build(pCity,
-       pCity->currently_building, pCity->is_building_unit, TRUE);
+       pCity->production.value, pCity->production.is_unit, TRUE);
     if(togrow == 999)
     {
       my_snprintf(cBuf, sizeof(cBuf), "%s", _("never"));
@@ -1010,17 +1010,17 @@ static struct GUI * real_city_report_dia
   copy_chars_to_string16(pWidget->string16, cBuf);
   
   /* change production */
-  if(pCity->is_building_unit) {
-    struct unit_type *pUnit = get_unit_type(pCity->currently_building);
+  if(pCity->production.is_unit) {
+    struct unit_type *pUnit = get_unit_type(pCity->production.value);
     pLogo = ResizeSurface(GET_SURF(pUnit->sprite), 36, 24, 1);
     SDL_SetColorKey(pLogo,
          SDL_SRCCOLORKEY|SDL_RLEACCEL, get_first_pixel(pLogo));
-    togrow = unit_build_shield_cost(pCity->currently_building);
+    togrow = unit_build_shield_cost(pCity->production.value);
     pName = pUnit->name;
   } else {
-    struct impr_type *pImprv = get_improvement_type(pCity->currently_building);
+    struct impr_type *pImprv = get_improvement_type(pCity->production.value);
     pLogo = ResizeSurface(GET_SURF(pImprv->sprite), 36, 24, 1);
-    togrow = impr_build_shield_cost(pCity->currently_building);
+    togrow = impr_build_shield_cost(pCity->production.value);
     pName = pImprv->name;
   }
     
@@ -1046,7 +1046,7 @@ static struct GUI * real_city_report_dia
   /* hurry productions */
   pWidget = pWidget->prev;
   togrow = city_turns_to_build(pCity,
-       pCity->currently_building, pCity->is_building_unit, TRUE);
+       pCity->production.value, pCity->production.is_unit, TRUE);
   if(togrow == 999)
   {
     my_snprintf(cBuf, sizeof(cBuf), "%s", _("never"));
Index: client/gui-sdl/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/mapview.c,v
retrieving revision 1.88
diff -p -u -r1.88 mapview.c
--- client/gui-sdl/mapview.c    5 May 2005 18:32:48 -0000       1.88
+++ client/gui-sdl/mapview.c    14 Jul 2005 21:13:28 -0000
@@ -1204,12 +1204,12 @@ static void put_city_desc_on_surface(SDL
   /* City Production */
   if (draw_city_productions && pCity->owner == game.player_idx) {
     /* set text color */
-    if (pCity->is_building_unit) {
+    if (pCity->production.is_unit) {
       pText->fgcol.r = 255;
       pText->fgcol.g = 255;
       pText->fgcol.b = 0;
     } else {
-      if (get_improvement_type(pCity->currently_building)->is_wonder) {
+      if (get_improvement_type(pCity->production.value)->is_wonder) {
        pText->fgcol.r = 0xe2;
        pText->fgcol.g = 0xc2;
        pText->fgcol.b = 0x1f;
Index: client/gui-sdl/repodlgs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/repodlgs.c,v
retrieving revision 1.45
diff -p -u -r1.45 repodlgs.c
--- client/gui-sdl/repodlgs.c   5 May 2005 18:32:48 -0000       1.45
+++ client/gui-sdl/repodlgs.c   14 Jul 2005 21:13:29 -0000
@@ -104,13 +104,13 @@ static void get_units_report_data(struct
   } unit_list_iterate_end;
     
   city_list_iterate(game.player_ptr->cities, pCity) {
-    if (pCity->is_building_unit) {
-      (entries[pCity->currently_building].building_count)++;
+    if (pCity->production.is_unit) {
+      (entries[pCity->production.value].building_count)++;
       (total->building_count)++;
-      entries[pCity->currently_building].soonest_completions =
-       MIN(entries[pCity->currently_building].soonest_completions,
+      entries[pCity->production.value].soonest_completions =
+       MIN(entries[pCity->production.value].soonest_completions,
            city_turns_to_build(pCity,
-                               pCity->currently_building, TRUE, TRUE));
+                               pCity->production.value, TRUE, TRUE));
     }
   } city_list_iterate_end;
 }
Index: client/gui-sdl/wldlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/wldlg.c,v
retrieving revision 1.16
diff -p -u -r1.16 wldlg.c
--- client/gui-sdl/wldlg.c      10 Feb 2005 18:35:17 -0000      1.16
+++ client/gui-sdl/wldlg.c      14 Jul 2005 21:13:29 -0000
@@ -81,8 +81,8 @@ struct EDITOR {
   struct GUI *pProduction_Progres;
     
   int stock;
-  int currently_building;
-  bool is_building_unit;
+  int production.value;
+  bool production.is_unit;
   
 } *pEditor = NULL;
 
@@ -159,23 +159,23 @@ static int ok_worklist_editor_callback(s
   
   if(pCity) {
     /* remove duplicate entry of currently building impv./wonder from worklist 
*/
-    if(!pEditor->is_building_unit) {
+    if(!pEditor->production.is_unit) {
       for(i = 0; i < MAX_LEN_WORKLIST; i++) {
        if(pEditor->pCopy_WorkList->wlefs[i] == WEF_END) {
          break;
         }
         if(pEditor->pCopy_WorkList->wlefs[i] == WEF_IMPR &&
-          pEditor->pCopy_WorkList->wlids[i] == pEditor->currently_building) {
+          pEditor->pCopy_WorkList->wlids[i] == pEditor->production.value) {
            worklist_remove(pEditor->pCopy_WorkList, i);
         }
       }
     }
     
     /* change production */
-    if(pEditor->is_building_unit != pCity->is_building_unit ||
-       pEditor->currently_building != pCity->currently_building) {
-      city_change_production(pCity, pEditor->is_building_unit,
-                            pEditor->currently_building);
+    if(pEditor->production.is_unit != pCity->production.is_unit ||
+       pEditor->production.value != pCity->production.value) {
+      city_change_production(pCity, pEditor->production.is_unit,
+                            pEditor->production.value);
       same_prod = FALSE;
     }
     
@@ -249,8 +249,8 @@ static void add_target_to_worklist(struc
   }
  
   /* Denny adding currently building Impr/Wonder Target */ 
-  if(pEditor->pCity && !is_unit && !pEditor->is_building_unit &&
-           (target == pEditor->currently_building)) {
+  if(pEditor->pCity && !is_unit && !pEditor->production.is_unit &&
+           (target == pEditor->production.value)) {
     return;
   }
   
@@ -333,11 +333,11 @@ static bool are_the_same_class(int id_1,
 static void change_production(int target, bool is_unit)
 {
     
-  if(!are_the_same_class(pEditor->currently_building,
-               pEditor->is_building_unit, target, is_unit)) {
+  if(!are_the_same_class(pEditor->production.value,
+               pEditor->production.is_unit, target, is_unit)) {
     if(pEditor->stock != pEditor->pCity->shield_stock) {
-      if(are_the_same_class(pEditor->pCity->currently_building,
-               pEditor->pCity->is_building_unit, target, is_unit)) {
+      if(are_the_same_class(pEditor->pCity->production.value,
+               pEditor->pCity->production.is_unit, target, is_unit)) {
        pEditor->stock = pEditor->pCity->shield_stock;
       }
     } else {
@@ -346,8 +346,8 @@ static void change_production(int target
     }            
   }
       
-  pEditor->currently_building = target;
-  pEditor->is_building_unit = is_unit;
+  pEditor->production.value = target;
+  pEditor->production.is_unit = is_unit;
   refresh_production_label(pEditor->stock);
 
   return;
@@ -381,8 +381,8 @@ static void add_target_to_production(str
   }
   
   /* check if we change to the same target */
-  if(((pEditor->currently_building == target) && 
-       (pEditor->is_building_unit == is_unit)) || pEditor->pCity->did_buy) {
+  if(((pEditor->production.value == target) && 
+       (pEditor->production.is_unit == is_unit)) || pEditor->pCity->did_buy) {
     /* comit changes and exit - double click detection */
     ok_worklist_editor_callback(NULL);
     return;
@@ -495,8 +495,8 @@ static void remove_item_from_worklist(st
     if(!pEditor->pCity->did_buy) {
       if(worklist_is_empty(pEditor->pCopy_WorkList)) {
         /* there is no worklist */
-        if(!(!pEditor->is_building_unit &&
-          (pEditor->currently_building == B_CAPITAL))) {
+        if(!(!pEditor->production.is_unit &&
+          (pEditor->production.value == B_CAPITAL))) {
          /* change to capitalization */
          int dummy;   
          change_production(B_CAPITAL, FALSE);
@@ -641,9 +641,9 @@ static void swap_item_up_from_worklist(s
   } else {
     if(!pEditor->pCity->did_buy) {
       /* change production ... */
-      id = pEditor->currently_building;
+      id = pEditor->production.value;
     
-      if(pEditor->is_building_unit) {
+      if(pEditor->production.is_unit) {
         flag = WEF_UNIT;
       } else {
         flag = WEF_IMPR;
@@ -983,18 +983,18 @@ static void refresh_production_label(int
   char cBuf[64];
   SDL_Rect area;
   const char *name = get_production_name(pEditor->pCity,
-                               pEditor->currently_building,
-                               pEditor->is_building_unit, &cost);
+                               pEditor->production.value,
+                               pEditor->production.is_unit, &cost);
 
-  if (!pEditor->is_building_unit
-     && pEditor->currently_building == B_CAPITAL)
+  if (!pEditor->production.is_unit
+     && pEditor->production.value == B_CAPITAL)
   {
      my_snprintf(cBuf, sizeof(cBuf),
        _("%s\n%d gold per turn"), name, MAX(0, 
pEditor->pCity->shield_surplus));
   } else {
     if(stock < cost) {
       turns = city_turns_to_build(pEditor->pCity,
-       pEditor->currently_building, pEditor->is_building_unit, TRUE);
+       pEditor->production.value, pEditor->production.is_unit, TRUE);
       if(turns == 999)
       {
         my_snprintf(cBuf, sizeof(cBuf), _("%s\nblocked!"), name);
@@ -1112,8 +1112,8 @@ void popup_worklist_editor(struct city *
   copy_worklist(pEditor->pCopy_WorkList, pWorkList);
   
   if(pCity) {
-    pEditor->is_building_unit = pCity->is_building_unit;
-    pEditor->currently_building = pCity->currently_building;
+    pEditor->production.is_unit = pCity->production.is_unit;
+    pEditor->production.value = pCity->production.value;
     pEditor->stock = pCity->shield_stock;
   }
   
@@ -1167,17 +1167,17 @@ void popup_worklist_editor(struct city *
     /* count == cost */
     /* turns == progress */
     const char *name = get_production_name(pCity,
-                               pCity->currently_building,
-                               pCity->is_building_unit, &count);
+                               pCity->production.value,
+                               pCity->production.is_unit, &count);
     
-    if (!pCity->is_building_unit && pCity->currently_building == B_CAPITAL)
+    if (!pCity->production.is_unit && pCity->production.value == B_CAPITAL)
     {
       my_snprintf(cBuf, sizeof(cBuf),
        _("%s\n%d gold per turn"), name, MAX(0, pCity->shield_surplus));
     } else {
       if(pCity->shield_stock < count) {
         turns = city_turns_to_build(pCity,
-         pCity->currently_building, pCity->is_building_unit, TRUE);
+         pCity->production.value, pCity->production.is_unit, TRUE);
         if(turns == 999)
         {
           my_snprintf(cBuf, sizeof(cBuf), _("%s\nblocked!"), name);
@@ -1260,18 +1260,18 @@ void popup_worklist_editor(struct city *
   if(pCity) {
    /* Production Widget Label */ 
     pStr = create_str16_from_char(get_production_name(pCity,
-                               pCity->currently_building,
-                               pCity->is_building_unit, &turns), 10);
+                               pCity->production.value,
+                               pCity->production.is_unit, &turns), 10);
     pStr->style |= SF_CENTER;
     pBuf = create_iconlabel(NULL, pDest, pStr, WF_DRAW_THEME_TRANSPARENT);
     
     set_wstate(pBuf, FC_WS_NORMAL);
     pBuf->action = worklist_editor_item_callback;
         
-    if(pCity->is_building_unit) {
-      add_to_gui_list(MAX_ID - pCity->currently_building, pBuf);
+    if(pCity->production.is_unit) {
+      add_to_gui_list(MAX_ID - pCity->production.value, pBuf);
     } else {
-      add_to_gui_list(MAX_ID - 1000 - pCity->currently_building, pBuf);
+      add_to_gui_list(MAX_ID - 1000 - pCity->production.value, pBuf);
     }
     
     pEditor->pWork->pEndWidgetList = pBuf;
Index: client/gui-win32/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/citydlg.c,v
retrieving revision 1.105
diff -p -u -r1.105 citydlg.c
--- client/gui-win32/citydlg.c  4 Jul 2005 17:48:37 -0000       1.105
+++ client/gui-win32/citydlg.c  14 Jul 2005 21:13:30 -0000
@@ -394,10 +394,10 @@ void city_dialog_update_building(struct 
 
   get_city_dialog_production(pcity, buf, sizeof(buf));
   
-  if (pcity->is_building_unit) {
-    descr = get_unit_type(pcity->currently_building)->name;
+  if (pcity->production.is_unit) {
+    descr = get_unit_type(pcity->production.value)->name;
   } else {
-    descr = get_impr_name_ex(pcity, pcity->currently_building);
+    descr = get_impr_name_ex(pcity, pcity->production.value);
   }
 
   my_snprintf(buf2, sizeof(buf2), "%s\r\n%s", descr, buf);
@@ -889,11 +889,11 @@ static void buy_callback(struct city_dia
   int value;
   const char *name;
   char buf[512];    
-   if(pdialog->pcity->is_building_unit) {
-    name=get_unit_type(pdialog->pcity->currently_building)->name;
+   if(pdialog->pcity->production.is_unit) {
+    name=get_unit_type(pdialog->pcity->production.value)->name;
   }
   else {
-    name=get_impr_name_ex(pdialog->pcity, pdialog->pcity->currently_building);
+    name=get_impr_name_ex(pdialog->pcity, pdialog->pcity->production.value);
   }
   value=city_buy_cost(pdialog->pcity);
  
@@ -1146,8 +1146,8 @@ static void commit_city_worklist(struct 
     if (!worklist_peek_ith(pwl, &id, &is_unit, k))
       break;
 
-    same_as_current_build = id == pdialog->pcity->currently_building
-        && is_unit == pdialog->pcity->is_building_unit;
+    same_as_current_build = id == pdialog->pcity->production.value
+        && is_unit == pdialog->pcity->production.is_unit;
 
     /* Very special case: If we are currently building a wonder we
        allow the construction to continue, even if we the wonder is
Index: client/gui-win32/repodlgs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/repodlgs.c,v
retrieving revision 1.50
diff -p -u -r1.50 repodlgs.c
--- client/gui-win32/repodlgs.c 23 May 2005 09:05:43 -0000      1.50
+++ client/gui-win32/repodlgs.c 14 Jul 2005 21:13:30 -0000
@@ -632,8 +632,8 @@ activeunits_report_dialog_update(void)
 
     unit_list_iterate_end;
     city_list_iterate(game.player_ptr->cities,pcity) {
-      if (pcity->is_building_unit) {
-        (unitarray[pcity->currently_building].building_count)++;
+      if (pcity->production.is_unit) {
+        (unitarray[pcity->production.value].building_count)++;
       }
     }
     city_list_iterate_end;
Index: client/gui-win32/wldlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/wldlg.c,v
retrieving revision 1.18
diff -p -u -r1.18 wldlg.c
--- client/gui-win32/wldlg.c    13 Apr 2005 03:38:14 -0000      1.18
+++ client/gui-win32/wldlg.c    14 Jul 2005 21:13:30 -0000
@@ -859,14 +859,14 @@ static void copy_worklist_to_editor(stru
 
 
 /****************************************************************
- sets aside the first space for "currently_building" if in city
+ sets aside the first space for "production.value" if in city
 *****************************************************************/
 static void worklist_prep(struct worklist_editor *peditor)
 {
   if (peditor->pcity) {
     peditor->worklist_wids[0] =
-        wid_encode(peditor->pcity->is_building_unit, FALSE,
-                   peditor->pcity->currently_building);
+        wid_encode(peditor->pcity->production.is_unit, FALSE,
+                   peditor->pcity->production.value);
     peditor->worklist_wids[1] = WORKLIST_END;
     copy_worklist_to_editor(&peditor->pcity->worklist, peditor,
                             MAX_LEN_WORKLIST);
Index: client/gui-xaw/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/citydlg.c,v
retrieving revision 1.140
diff -p -u -r1.140 citydlg.c
--- client/gui-xaw/citydlg.c    7 May 2005 07:26:18 -0000       1.140
+++ client/gui-xaw/citydlg.c    14 Jul 2005 21:13:30 -0000
@@ -1469,9 +1469,9 @@ void city_dialog_update_building(struct 
   XtSetSensitive(pdialog->sell_command, !pcity->did_sell);
 
   xaw_set_label(pdialog->building_label,
-               pcity->is_building_unit ?
-                 get_unit_type(pcity->currently_building)->name :
-                 get_impr_name_ex(pcity, pcity->currently_building));
+               pcity->production.is_unit ?
+                 get_unit_type(pcity->production.value)->name :
+                 get_impr_name_ex(pcity, pcity->production.value));
 
   get_contents_of_progress(pdialog, buf, sizeof(buf));
   xaw_set_label(pdialog->progress_label, buf);
@@ -1870,11 +1870,11 @@ void buy_callback(Widget w, XtPointer cl
   
   pdialog=(struct city_dialog *)client_data;
 
-  if(pdialog->pcity->is_building_unit) {
-    name=get_unit_type(pdialog->pcity->currently_building)->name;
+  if(pdialog->pcity->production.is_unit) {
+    name=get_unit_type(pdialog->pcity->production.value)->name;
   }
   else {
-    name=get_impr_name_ex(pdialog->pcity, pdialog->pcity->currently_building);
+    name=get_impr_name_ex(pdialog->pcity, pdialog->pcity->production.value);
   }
   value=city_buy_cost(pdialog->pcity);
  
@@ -2190,8 +2190,8 @@ void commit_city_worklist(struct worklis
     int same_as_current_build;
     if (! worklist_peek_ith(pwl, &id, &is_unit, k))
       break;
-    same_as_current_build = id == pdialog->pcity->currently_building
-      && is_unit == pdialog->pcity->is_building_unit;
+    same_as_current_build = id == pdialog->pcity->production.value
+      && is_unit == pdialog->pcity->production.is_unit;
 
     /* Very special case: If we are currently building a wonder we
        allow the construction to continue, even if we the wonder is
Index: client/gui-xaw/repodlgs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/repodlgs.c,v
retrieving revision 1.71
diff -p -u -r1.71 repodlgs.c
--- client/gui-xaw/repodlgs.c   21 Jun 2005 16:21:01 -0000      1.71
+++ client/gui-xaw/repodlgs.c   14 Jul 2005 21:13:31 -0000
@@ -1075,8 +1075,8 @@ void activeunits_report_dialog_update(vo
     }
     unit_list_iterate_end;
     city_list_iterate(game.player_ptr->cities,pcity) {
-      if (pcity->is_building_unit) {
-       (unitarray[pcity->currently_building].building_count)++;
+      if (pcity->production.is_unit) {
+       (unitarray[pcity->production.value].building_count)++;
       }
     }
     city_list_iterate_end;
Index: client/gui-xaw/wldlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/wldlg.c,v
retrieving revision 1.26
diff -p -u -r1.26 wldlg.c
--- client/gui-xaw/wldlg.c      19 Dec 2004 18:53:15 -0000      1.26
+++ client/gui-xaw/wldlg.c      14 Jul 2005 21:13:31 -0000
@@ -1246,12 +1246,12 @@ void worklist_populate_worklist(struct w
   n = 0;
   if (pdialog->pcity) {
     /* First element is the current build target of the city. */
-    id = pdialog->pcity->currently_building;
+    id = pdialog->pcity->production.value;
 
     worklist_id_to_name(pdialog->worklist_names[n],
-                       id, pdialog->pcity->is_building_unit, pdialog->pcity);
+                       id, pdialog->pcity->production.is_unit, pdialog->pcity);
 
-    if (pdialog->pcity->is_building_unit)
+    if (pdialog->pcity->production.is_unit)
       id += B_LAST;
     pdialog->worklist_names_ptrs[n] = pdialog->worklist_names[n];
     pdialog->worklist_ids[n] = id;
Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.354
diff -p -u -r1.354 city.c
--- common/city.c       14 Jul 2005 19:25:45 -0000      1.354
+++ common/city.c       14 Jul 2005 21:13:31 -0000
@@ -371,10 +371,10 @@ int city_buy_cost(const struct city *pci
 {
   int cost, build = pcity->shield_stock;
 
-  if (pcity->is_building_unit) {
-    cost = unit_buy_gold_cost(pcity->currently_building, build);
+  if (pcity->production.is_unit) {
+    cost = unit_buy_gold_cost(pcity->production.value, build);
   } else {
-    cost = impr_buy_gold_cost(pcity->currently_building, build);
+    cost = impr_buy_gold_cost(pcity->production.value, build);
   }
   return cost;
 }
@@ -2400,8 +2400,8 @@ struct city *create_city_virtual(struct 
     int u = best_role_unit(pcity, L_FIRSTBUILD);
 
     if (u < U_LAST && u >= 0) {
-      pcity->is_building_unit = TRUE;
-      pcity->currently_building = u;
+      pcity->production.is_unit = TRUE;
+      pcity->production.value = u;
     } else {
       bool found = FALSE;
 
@@ -2410,8 +2410,8 @@ struct city *create_city_virtual(struct 
       impr_type_iterate(id) {
        if (can_build_improvement_direct(pcity, id)) {
          found = TRUE;
-         pcity->is_building_unit = FALSE;
-         pcity->currently_building = id;
+         pcity->production.is_unit = FALSE;
+         pcity->production.value = id;
          break;
        }
       } impr_type_iterate_end;
@@ -2420,8 +2420,8 @@ struct city *create_city_virtual(struct 
        unit_type_iterate(id) {
          if (can_build_unit_direct(pcity, id)) {
            found = TRUE;
-           pcity->is_building_unit = TRUE;
-           pcity->currently_building = id;
+           pcity->production.is_unit = TRUE;
+           pcity->production.value = id;
          }
        } unit_type_iterate_end;
       }
@@ -2435,8 +2435,8 @@ struct city *create_city_virtual(struct 
   pcity->airlift = FALSE;
 
   pcity->turn_last_built = game.info.turn;
-  pcity->changed_from_id = pcity->currently_building;
-  pcity->changed_from_is_unit = pcity->is_building_unit;
+  pcity->changed_from_id = pcity->production.value;
+  pcity->changed_from_is_unit = pcity->production.is_unit;
   pcity->before_change_shields = 0;
   pcity->disbanded_shields = 0;
   pcity->caravan_shields = 0;
Index: common/city.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.h,v
retrieving revision 1.216
diff -p -u -r1.216 city.h
--- common/city.h       4 Jul 2005 17:48:37 -0000       1.216
+++ common/city.h       14 Jul 2005 21:13:31 -0000
@@ -144,6 +144,11 @@ struct output_type {
   enum output_unhappy_penalty unhappy_penalty;
 };
 
+struct city_production {
+  bool is_unit;
+  int value; /* Unit_type_id or Impr_type_id */
+};
+
 enum choice_type { CT_NONE = 0, CT_BUILDING = 0, CT_NONMIL, CT_ATTACKER,
                    CT_DEFENDER, CT_LAST };
 
@@ -253,9 +258,8 @@ struct city {
   int pollution;
   /* city can't be incited if INCITE_IMPOSSIBLE_COST */
   int incite_revolt_cost;      
-   
-  bool is_building_unit;    /* boolean unit/improvement */
-  int currently_building;
+
+  struct city_production production;
   
   Impr_Status improvements[B_LAST];
 
Index: common/effects.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/effects.c,v
retrieving revision 1.44
diff -p -u -r1.44 effects.c
--- common/effects.c    14 May 2005 22:35:28 -0000      1.44
+++ common/effects.c    14 Jul 2005 21:13:32 -0000
@@ -882,8 +882,8 @@ int get_city_bonus_effects(struct effect
 int get_current_construction_bonus(const struct city *pcity,
                                   enum effect_type effect_type)
 {
-  if (!pcity->is_building_unit) {
-    Impr_type_id id = pcity->currently_building;
+  if (!pcity->production.is_unit) {
+    Impr_type_id id = pcity->production.value;
     int power = 0;
 
     struct req_source source = {
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.140
diff -p -u -r1.140 packets.def
--- common/packets.def  4 Jul 2005 18:42:27 -0000       1.140
+++ common/packets.def  14 Jul 2005 21:13:32 -0000
@@ -499,8 +499,8 @@ PACKET_CITY_INFO=21; is-info,sc,lsend
 
   UINT16 pollution;
 
-  UINT8 currently_building;
-  BOOL is_building_unit;
+  BOOL production_is_unit;
+  UINT8 production_value;
 
   TURN turn_last_built;
   UINT8 changed_from_id;
Index: common/packets_gen.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets_gen.c,v
retrieving revision 1.140
diff -p -u -r1.140 packets_gen.c
--- common/packets_gen.c        4 Jul 2005 18:42:27 -0000       1.140
+++ common/packets_gen.c        14 Jul 2005 21:13:33 -0000
@@ -6433,15 +6433,15 @@ static struct packet_city_info *receive_
       real_packet->pollution = readin;
     }
   }
-  if (BV_ISSET(fields, 22)) {
+  real_packet->production_is_unit = BV_ISSET(fields, 22);
+  if (BV_ISSET(fields, 23)) {
     {
       int readin;
     
       dio_get_uint8(&din, &readin);
-      real_packet->currently_building = readin;
+      real_packet->production_value = readin;
     }
   }
-  real_packet->is_building_unit = BV_ISSET(fields, 23);
   if (BV_ISSET(fields, 24)) {
     {
       int readin;
@@ -6811,13 +6811,13 @@ static int send_packet_city_info_100(str
   if(differ) {different++;}
   if(differ) {BV_SET(fields, 21);}
 
-  differ = (old->currently_building != real_packet->currently_building);
+  differ = (old->production_is_unit != real_packet->production_is_unit);
   if(differ) {different++;}
-  if(differ) {BV_SET(fields, 22);}
+  if(packet->production_is_unit) {BV_SET(fields, 22);}
 
-  differ = (old->is_building_unit != real_packet->is_building_unit);
+  differ = (old->production_value != real_packet->production_value);
   if(differ) {different++;}
-  if(packet->is_building_unit) {BV_SET(fields, 23);}
+  if(differ) {BV_SET(fields, 23);}
 
   differ = (old->turn_last_built != real_packet->turn_last_built);
   if(differ) {different++;}
@@ -7063,10 +7063,10 @@ static int send_packet_city_info_100(str
   if (BV_ISSET(fields, 21)) {
     dio_put_uint16(&dout, real_packet->pollution);
   }
-  if (BV_ISSET(fields, 22)) {
-    dio_put_uint8(&dout, real_packet->currently_building);
+  /* field 22 is folded into the header */
+  if (BV_ISSET(fields, 23)) {
+    dio_put_uint8(&dout, real_packet->production_value);
   }
-  /* field 23 is folded into the header */
   if (BV_ISSET(fields, 24)) {
     dio_put_sint16(&dout, real_packet->turn_last_built);
   }
Index: common/packets_gen.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets_gen.h,v
retrieving revision 1.124
diff -p -u -r1.124 packets_gen.h
--- common/packets_gen.h        27 Jun 2005 14:30:18 -0000      1.124
+++ common/packets_gen.h        14 Jul 2005 21:13:33 -0000
@@ -261,8 +261,8 @@ struct packet_city_info {
   int trade[NUM_TRADEROUTES];
   int trade_value[NUM_TRADEROUTES];
   int pollution;
-  int currently_building;
-  bool is_building_unit;
+  bool production_is_unit;
+  int production_value;
   int turn_last_built;
   int changed_from_id;
   bool changed_from_is_unit;
Index: common/unit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unit.c,v
retrieving revision 1.245
diff -p -u -r1.245 unit.c
--- common/unit.c       14 Jul 2005 19:25:45 -0000      1.245
+++ common/unit.c       14 Jul 2005 21:13:37 -0000
@@ -180,10 +180,10 @@ bool unit_can_help_build_wonder(const st
 
   return (unit_flag(punit, F_HELP_WONDER)
          && punit->owner == pcity->owner
-         && !pcity->is_building_unit
-         && is_wonder(pcity->currently_building)
+         && !pcity->production.is_unit
+         && is_wonder(pcity->production.value)
          && (pcity->shield_stock
-             < impr_build_shield_cost(pcity->currently_building)));
+             < impr_build_shield_cost(pcity->production.value)));
 }
 
 
Index: common/aicore/caravan.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/aicore/caravan.c,v
retrieving revision 1.2
diff -p -u -r1.2 caravan.c
--- common/aicore/caravan.c     4 Jul 2005 17:48:37 -0000       1.2
+++ common/aicore/caravan.c     14 Jul 2005 21:13:37 -0000
@@ -326,17 +326,17 @@ static double wonder_benefit(const struc
 
   if (!param->consider_wonders
       || caravan->owner != dest->owner
-      || dest->is_building_unit
-      || !is_wonder(dest->currently_building)) {
+      || dest->production.is_unit
+      || !is_wonder(dest->production.value)) {
     return 0;
   }
 
   shields_at_arrival = dest->shield_stock
     + arrival_time * dest->surplus[O_SHIELD];
 
-  costwithout = impr_buy_gold_cost(dest->currently_building,
+  costwithout = impr_buy_gold_cost(dest->production.value,
       shields_at_arrival);
-  costwith = impr_buy_gold_cost(dest->currently_building,
+  costwith = impr_buy_gold_cost(dest->production.value,
       shields_at_arrival + unit_build_shield_cost(caravan->type));
 
   assert(costwithout >= costwith);
Index: server/cityhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityhand.c,v
retrieving revision 1.147
diff -p -u -r1.147 cityhand.c
--- server/cityhand.c   5 May 2005 18:32:52 -0000       1.147
+++ server/cityhand.c   14 Jul 2005 21:13:37 -0000
@@ -230,25 +230,25 @@ void really_handle_city_buy(struct playe
   }
 
   if (get_current_construction_bonus(pcity, EFT_PROD_TO_GOLD) > 0) {
-    assert(!pcity->is_building_unit);
+    assert(!pcity->production.is_unit);
     notify_player_ex(pplayer, pcity->tile, E_NOEVENT,
                      _("You don't buy %s!"),
-                    improvement_types[pcity->currently_building].name);
+                    improvement_types[pcity->production.value].name);
     return;
   }
 
-  if (pcity->is_building_unit && pcity->anarchy != 0) {
+  if (pcity->production.is_unit && pcity->anarchy != 0) {
     notify_player_ex(pplayer, pcity->tile, E_NOEVENT, 
                     _("Can't buy units when city is in disorder."));
     return;
   }
 
-  if (pcity->is_building_unit) {
-    name = unit_types[pcity->currently_building].name;
-    total = unit_build_shield_cost(pcity->currently_building);
+  if (pcity->production.is_unit) {
+    name = unit_types[pcity->production.value].name;
+    total = unit_build_shield_cost(pcity->production.value);
   } else {
-    name = get_improvement_name(pcity->currently_building);
-    total = impr_build_shield_cost(pcity->currently_building);
+    name = get_improvement_name(pcity->production.value);
+    total = impr_build_shield_cost(pcity->production.value);
   }
   cost = city_buy_cost(pcity);
   if (cost <= 0) {
@@ -341,8 +341,8 @@ void handle_city_change(struct player *p
     return;
   }
 
-  if (pcity->is_building_unit == is_build_id_unit_id
-      && pcity->currently_building == build_id) {
+  if (pcity->production.is_unit == is_build_id_unit_id
+      && pcity->production.value == build_id) {
     /* The client probably shouldn't send such a packet. */
     return;
   }
Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.334
diff -p -u -r1.334 citytools.c
--- server/citytools.c  14 Jul 2005 19:25:46 -0000      1.334
+++ server/citytools.c  14 Jul 2005 21:13:38 -0000
@@ -459,7 +459,7 @@ char *city_name_suggestion(struct player
 **************************************************************************/
 int build_points_left(struct city *pcity)
 {
-  int cost = impr_build_shield_cost(pcity->currently_building);
+  int cost = impr_build_shield_cost(pcity->production.value);
 
   return cost - pcity->shield_stock;
 }
@@ -868,10 +868,10 @@ void transfer_city(struct player *ptaker
   } built_impr_iterate_end;
 
   /* Set production to something valid for pplayer, if not. */
-  if ((pcity->is_building_unit
-       && !can_build_unit_direct(pcity, pcity->currently_building))
-      || (!pcity->is_building_unit
-          && !can_build_improvement(pcity, pcity->currently_building))) {
+  if ((pcity->production.is_unit
+       && !can_build_unit_direct(pcity, pcity->production.value))
+      || (!pcity->production.is_unit
+          && !can_build_improvement(pcity, pcity->production.value))) {
     advisor_choose_build(ptaker, pcity);
   } 
 
@@ -1565,8 +1565,8 @@ void package_city(struct city *pcity, st
 
   packet->city_options=pcity->city_options;
   
-  packet->is_building_unit=pcity->is_building_unit;
-  packet->currently_building=pcity->currently_building;
+  packet->production_is_unit = pcity->production.is_unit;
+  packet->production_value = pcity->production.value;
 
   packet->turn_last_built=pcity->turn_last_built;
   packet->turn_founded = pcity->turn_founded;
@@ -1783,13 +1783,13 @@ void change_build_target(struct player *
   const char *source;
 
   /* If the city is already building this thing, don't do anything */
-  if (pcity->is_building_unit == is_unit &&
-      pcity->currently_building == target) {
+  if (pcity->production.is_unit == is_unit &&
+      pcity->production.value == target) {
     return;
   }
 
   /* Is the city no longer building a wonder? */
-  if (!pcity->is_building_unit && is_great_wonder(pcity->currently_building) &&
+  if (!pcity->production.is_unit && is_great_wonder(pcity->production.value) &&
       (event != E_IMP_AUTO && event != E_WORKLIST)) {
     /* If the build target is changed because of an advisor's suggestion or
        because the worklist advances, then the wonder was completed -- 
@@ -1798,7 +1798,7 @@ void change_build_target(struct player *
     notify_player_ex(NULL, pcity->tile, E_WONDER_STOPPED,
                     _("The %s have stopped building The %s in %s."),
                     get_nation_name_plural(pplayer->nation),
-                    get_impr_name_ex(pcity, pcity->currently_building),
+                    get_impr_name_ex(pcity, pcity->production.value),
                     pcity->name);
   }
 
@@ -1807,14 +1807,14 @@ void change_build_target(struct player *
   pcity->shield_stock = city_change_production_penalty(pcity, target, is_unit);
 
   /* Change build target. */
-  pcity->currently_building = target;
-  pcity->is_building_unit = is_unit;
+  pcity->production.value = target;
+  pcity->production.is_unit = is_unit;
 
   /* What's the name of the target? */
   if (is_unit)
-    name = unit_types[pcity->currently_building].name;
+    name = unit_types[pcity->production.value].name;
   else
-    name = improvement_types[pcity->currently_building].name;
+    name = improvement_types[pcity->production.value].name;
 
   switch (event) {
     case E_WORKLIST: source = _(" from the worklist"); break;
@@ -1841,11 +1841,11 @@ void change_build_target(struct player *
 
   /* If the city is building a wonder, tell the rest of the world
      about it. */
-  if (!pcity->is_building_unit && is_great_wonder(pcity->currently_building)) {
+  if (!pcity->production.is_unit && is_great_wonder(pcity->production.value)) {
     notify_player_ex(NULL, pcity->tile, E_WONDER_STARTED,
                     _("The %s have started building The %s in %s."),
                     get_nation_name_plural(pplayer->nation),
-                    get_impr_name_ex(pcity, pcity->currently_building),
+                    get_impr_name_ex(pcity, pcity->production.value),
                     pcity->name);
   }
 }
Index: server/cityturn.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v
retrieving revision 1.323
diff -p -u -r1.323 cityturn.c
--- server/cityturn.c   4 Jul 2005 17:48:38 -0000       1.323
+++ server/cityturn.c   14 Jul 2005 21:13:38 -0000
@@ -293,15 +293,15 @@ void send_global_city_turn_notifications
     city_list_iterate(pplayer->cities, pcity) {
       /* can_player_build_improvement() checks whether wonder is build
         elsewhere (or destroyed) */
-      if (!pcity->is_building_unit && 
is_great_wonder(pcity->currently_building)
-         && (city_turns_to_build(pcity, pcity->currently_building, FALSE, TRUE)
+      if (!pcity->production.is_unit && 
is_great_wonder(pcity->production.value)
+         && (city_turns_to_build(pcity, pcity->production.value, FALSE, TRUE)
              <= 1)
-         && can_player_build_improvement(city_owner(pcity), 
pcity->currently_building)) {
+         && can_player_build_improvement(city_owner(pcity), 
pcity->production.value)) {
        notify_conn_ex(dest, pcity->tile,
                       E_WONDER_WILL_BE_BUILT,
                       _("Notice: Wonder %s in %s will be finished"
                         " next turn."), 
-                      get_improvement_name(pcity->currently_building),
+                      get_improvement_name(pcity->production.value),
                       pcity->name);
       }
     } city_list_iterate_end;
@@ -325,7 +325,7 @@ void send_city_turn_notifications(struct
        && get_current_construction_bonus(pcity, EFT_GROWTH_FOOD) > 0
        && pcity->surplus[O_SHIELD] > 0) {
       /* From the check above, the surplus must always be positive. */
-      turns_granary = (impr_build_shield_cost(pcity->currently_building)
+      turns_granary = (impr_build_shield_cost(pcity->production.value)
                       - pcity->shield_stock) / pcity->surplus[O_SHIELD];
       /* if growth and granary completion occur simultaneously, granary
         preserves food.  -AJS */
@@ -335,7 +335,7 @@ void send_city_turn_notifications(struct
                         E_CITY_GRAN_THROTTLE,
                         _("Suggest throttling growth in %s to use %s "
                           "(being built) more effectively."), pcity->name,
-                        improvement_types[pcity->currently_building].name);
+                        improvement_types[pcity->production.value].name);
       }
     }
 
@@ -469,7 +469,7 @@ static void city_increase_size(struct ci
       notify_player_ex(powner, pcity->tile, E_CITY_AQ_BUILDING,
                       _("%s needs %s (being built) "
                         "to grow any further."), pcity->name,
-                      improvement_types[pcity->currently_building].name);
+                      improvement_types[pcity->production.value].name);
     } else {
       notify_player_ex(powner, pcity->tile, E_CITY_AQUEDUCT,
                       _("%s needs an improvement to grow any further."),
@@ -871,12 +871,12 @@ static void choose_build_target(struct p
 
   /* Try building the same thing again.  Repeat building doesn't require a
    * call to change_build_target, so just return. */
-  if (pcity->is_building_unit) {
+  if (pcity->production.is_unit) {
     /* We can build a unit again unless it's unique. */
-    if (!unit_type_flag(pcity->currently_building, F_UNIQUE)) {
+    if (!unit_type_flag(pcity->production.value, F_UNIQUE)) {
       return;
     }
-  } else if (can_build_improvement(pcity, pcity->currently_building)) {
+  } else if (can_build_improvement(pcity, pcity->production.value)) {
     /* We can build space and coinage again, and possibly others. */
     return;
   }
@@ -918,15 +918,15 @@ static void upgrade_building_prod(struct
 {
   struct player *pplayer = city_owner(pcity);
   Impr_type_id upgrades_to = building_upgrades_to(pcity,
-                                                 pcity->currently_building);
+                                                 pcity->production.value);
 
   if (can_build_improvement(pcity, upgrades_to)) {
     notify_player_ex(pplayer, pcity->tile, E_UNIT_UPGRADED,
                     _("Production of %s is upgraded to %s in %s."),
-                    get_improvement_type(pcity->currently_building)->name,
+                    get_improvement_type(pcity->production.value)->name,
                     get_improvement_type(upgrades_to)->name,
                     pcity->name);
-    pcity->currently_building = upgrades_to;
+    pcity->production.value = upgrades_to;
   }
 }
 
@@ -963,11 +963,11 @@ static Unit_type_id unit_upgrades_to(str
 static void upgrade_unit_prod(struct city *pcity)
 {
   struct player *pplayer = city_owner(pcity);
-  int id = pcity->currently_building;
-  int id2 = unit_upgrades_to(pcity, pcity->currently_building);
+  int id = pcity->production.value;
+  int id2 = unit_upgrades_to(pcity, pcity->production.value);
 
   if (id2 != -1 && can_build_unit_direct(pcity, id2)) {
-    pcity->currently_building = id2;
+    pcity->production.value = id2;
     notify_player_ex(pplayer, pcity->tile, E_UNIT_UPGRADED, 
                  _("Production of %s is upgraded to %s in %s."),
                  get_unit_type(id)->name, 
@@ -1037,7 +1037,7 @@ static bool city_build_building(struct p
 {
   bool space_part;
   int mod;
-  Impr_type_id id = pcity->currently_building;
+  Impr_type_id id = pcity->production.value;
   struct impr_type *building = get_improvement_type(id);
 
   if (get_current_construction_bonus(pcity, EFT_PROD_TO_GOLD) > 0) {
@@ -1162,27 +1162,27 @@ static bool city_build_unit(struct playe
   struct unit_type *utype;
 
   upgrade_unit_prod(pcity);
-  utype = get_unit_type(pcity->currently_building);
+  utype = get_unit_type(pcity->production.value);
 
   /* We must make a special case for barbarians here, because they are
      so dumb. Really. They don't know the prerequisite techs for units
      they build!! - Per */
-  if (!can_build_unit_direct(pcity, pcity->currently_building)
+  if (!can_build_unit_direct(pcity, pcity->production.value)
       && !is_barbarian(pplayer)) {
     notify_player_ex(pplayer, pcity->tile, E_CITY_CANTBUILD,
         _("%s is building %s, which is no longer available."),
-        pcity->name, unit_name(pcity->currently_building));
+        pcity->name, unit_name(pcity->production.value));
     script_signal_emit("unit_cant_be_built", 3,
                       API_TYPE_UNIT_TYPE, utype,
                       API_TYPE_CITY, pcity,
                       API_TYPE_STRING, "unavailable");
     freelog(LOG_VERBOSE, _("%s's %s tried build %s, which is not available"),
-            pplayer->name, pcity->name, unit_name(pcity->currently_building)); 
           
+            pplayer->name, pcity->name, unit_name(pcity->production.value));   
         
     return TRUE;
   }
   if (pcity->shield_stock
-      >= unit_build_shield_cost(pcity->currently_building)) {
-    int pop_cost = unit_pop_value(pcity->currently_building);
+      >= unit_build_shield_cost(pcity->production.value)) {
+    int pop_cost = unit_pop_value(pcity->production.value);
     struct unit *punit;
 
     /* Should we disband the city? -- Massimo */
@@ -1194,7 +1194,7 @@ static bool city_build_unit(struct playe
     if (pcity->size <= pop_cost) {
       notify_player_ex(pplayer, pcity->tile, E_CITY_CANTBUILD,
                       _("%s can't build %s yet."),
-                      pcity->name, unit_name(pcity->currently_building));
+                      pcity->name, unit_name(pcity->production.value));
       script_signal_emit("unit_cant_be_built", 3,
                         API_TYPE_UNIT_TYPE, utype,
                         API_TYPE_CITY, pcity,
@@ -1207,9 +1207,9 @@ static bool city_build_unit(struct playe
     /* don't update turn_last_built if we returned above */
     pcity->turn_last_built = game.info.turn;
 
-    punit = create_unit(pplayer, pcity->tile, pcity->currently_building,
+    punit = create_unit(pplayer, pcity->tile, pcity->production.value,
                        do_make_unit_veteran(pcity,
-                                            pcity->currently_building),
+                                            pcity->production.value),
                        pcity->id, 0);
 
     /* After we created the unit remove the citizen. This will also
@@ -1222,15 +1222,15 @@ static bool city_build_unit(struct playe
     /* to eliminate micromanagement, we only subtract the unit's
        cost */
     pcity->before_change_shields
-      -= unit_build_shield_cost(pcity->currently_building);
+      -= unit_build_shield_cost(pcity->production.value);
     pcity->shield_stock
-      -= unit_build_shield_cost(pcity->currently_building);
+      -= unit_build_shield_cost(pcity->production.value);
 
     notify_player_ex(pplayer, pcity->tile, E_UNIT_BUILT,
                     /* TRANS: <city> is finished building <unit/building>. */
                     _("%s is finished building %s."),
                     pcity->name,
-                    unit_types[pcity->currently_building].name);
+                    unit_types[pcity->production.value].name);
 
     script_signal_emit("unit_built",
                       2, API_TYPE_UNIT, punit, API_TYPE_CITY, pcity);
@@ -1255,7 +1255,7 @@ static bool city_build_stuff(struct play
   nullify_caravan_and_disband_plus(pcity);
   define_orig_production_values(pcity);
 
-  if (!pcity->is_building_unit) {
+  if (!pcity->production.is_unit) {
     return city_build_building(pplayer, pcity);
   } else {
     return city_build_unit(pplayer, pcity);
@@ -1410,8 +1410,8 @@ static void define_orig_production_value
    * city have been dedicated toward the project that was chosen last turn,
    * so the player shouldn't be penalized if the governor has to pick
    * something different.  See city_change_production_penalty(). */
-  pcity->changed_from_id = pcity->currently_building;
-  pcity->changed_from_is_unit = pcity->is_building_unit;
+  pcity->changed_from_id = pcity->production.value;
+  pcity->changed_from_is_unit = pcity->production.is_unit;
 
   freelog(LOG_DEBUG,
          "In %s, building %s.  Beg of Turn shields = %d",
@@ -1530,7 +1530,7 @@ static bool disband_city(struct city *pc
   struct player *pplayer = city_owner(pcity);
   struct tile *ptile = pcity->tile;
   struct city *rcity=NULL;
-  struct unit_type *utype = get_unit_type(pcity->currently_building);
+  struct unit_type *utype = get_unit_type(pcity->production.value);
 
   /* find closest city other than pcity */
   rcity = find_closest_owned_city(pplayer, ptile, FALSE, pcity);
@@ -1540,7 +1540,7 @@ static bool disband_city(struct city *pc
     notify_player_ex(pplayer, ptile, E_CITY_CANTBUILD,
                     _("%s can't build %s yet, "
                     "and we can't disband our only city."),
-                    pcity->name, unit_name(pcity->currently_building));
+                    pcity->name, unit_name(pcity->production.value));
     script_signal_emit("unit_cant_be_built", 3,
                       API_TYPE_UNIT_TYPE, utype,
                       API_TYPE_CITY, pcity,
@@ -1548,8 +1548,8 @@ static bool disband_city(struct city *pc
     return FALSE;
   }
 
-  (void) create_unit(pplayer, ptile, pcity->currently_building,
-                    do_make_unit_veteran(pcity, pcity->currently_building),
+  (void) create_unit(pplayer, ptile, pcity->production.value,
+                    do_make_unit_veteran(pcity, pcity->production.value),
                     pcity->id, 0);
 
   /* Shift all the units supported by pcity (including the new unit)
@@ -1562,7 +1562,7 @@ static bool disband_city(struct city *pc
   notify_player_ex(pplayer, ptile, E_UNIT_BUILT,
                   /* TRANS: Settler production leads to disbanded city. */
                   _("%s is disbanded into %s."), 
-                  pcity->name, unit_types[pcity->currently_building].name);
+                  pcity->name, unit_types[pcity->production.value].name);
   gamelog(GAMELOG_DISBANDCITY, pcity);
 
   remove_city(pcity);
Index: server/diplomats.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/diplomats.c,v
retrieving revision 1.86
diff -p -u -r1.86 diplomats.c
--- server/diplomats.c  12 Jul 2005 17:57:53 -0000      1.86
+++ server/diplomats.c  14 Jul 2005 21:13:38 -0000
@@ -927,10 +927,10 @@ void diplomat_sabotage(struct player *pp
     nullify_prechange_production(pcity); /* Make it impossible to recover */
 
     /* Report it. */
-    if (pcity->is_building_unit)
-      prod = unit_name (pcity->currently_building);
+    if (pcity->production.is_unit)
+      prod = unit_name (pcity->production.value);
     else
-      prod = get_improvement_name (pcity->currently_building);
+      prod = get_improvement_name (pcity->production.value);
     notify_player_ex(pplayer, pcity->tile, E_MY_DIPLOMAT_SABOTAGE,
                     _("Your %s succeeded in destroying"
                       " the production of %s in %s."),
Index: server/gamelog.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/gamelog.c,v
retrieving revision 1.51
diff -p -u -r1.51 gamelog.c
--- server/gamelog.c    12 Jul 2005 21:25:47 -0000      1.51
+++ server/gamelog.c    14 Jul 2005 21:13:38 -0000
@@ -427,16 +427,16 @@ void gamelog(int level, ...)
                 "<n>%d</n><city>%s</city><u>%d</u>"
                 "<w>%d</w><name>%s</name><m>%s build %s in %s</m>",
                 city_owner(pcity)->player_no, pcity->name,
-                pcity->is_building_unit ? 1 : 0,
-                (!pcity->is_building_unit 
-                 && is_wonder(pcity->currently_building)) ? 1 : 0,
-                pcity->is_building_unit ? 
-                  unit_types[pcity->currently_building].name :
-                  get_impr_name_ex(pcity, pcity->currently_building),
+                pcity->production.is_unit ? 1 : 0,
+                (!pcity->production.is_unit 
+                 && is_wonder(pcity->production.value)) ? 1 : 0,
+                pcity->production.is_unit ? 
+                  unit_types[pcity->production.value].name :
+                  get_impr_name_ex(pcity, pcity->production.value),
                 get_nation_name_plural(city_owner(pcity)->nation),
-                pcity->is_building_unit ? 
-                  unit_types[pcity->currently_building].name :
-                  get_impr_name_ex(pcity, pcity->currently_building),
+                pcity->production.is_unit ? 
+                  unit_types[pcity->production.value].name :
+                  get_impr_name_ex(pcity, pcity->production.value),
                 pcity->name);
     gamelog_put_prefix(buf, sizeof(buf), "build");
     break;
Index: server/report.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/report.c,v
retrieving revision 1.67
diff -p -u -r1.67 report.c
--- server/report.c     30 Jun 2005 20:18:37 -0000      1.67
+++ server/report.c     14 Jul 2005 21:13:39 -0000
@@ -314,7 +314,7 @@ void report_wonders_of_the_world(struct 
     if (is_great_wonder(i)) {
       players_iterate(pplayer) {
        city_list_iterate(pplayer->cities, pcity) {
-         if (pcity->currently_building == i && !pcity->is_building_unit) {
+         if (pcity->production.value == i && !pcity->production.is_unit) {
            cat_snprintf(buffer, sizeof(buffer),
                         _("(building %s in %s (%s))\n"),
                         get_improvement_type(i)->name, pcity->name,
Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.262
diff -p -u -r1.262 savegame.c
--- server/savegame.c   14 Jul 2005 19:25:46 -0000      1.262
+++ server/savegame.c   14 Jul 2005 21:13:40 -0000
@@ -2147,26 +2147,26 @@ static void player_load(struct player *p
     pcity->was_happy = secfile_lookup_bool(file,
                                           "player%d.c%d.was_happy",
                                           plrno, i);
-    pcity->is_building_unit =
+    pcity->production.is_unit =
       secfile_lookup_bool(file, 
-                        "player%d.c%d.is_building_unit", plrno, i);
+                        "player%d.c%d.production.is_unit", plrno, i);
     name = secfile_lookup_str_default(file, NULL,
-                                     "player%d.c%d.currently_building_name",
+                                     "player%d.c%d.production.value_name",
                                      plrno, i);
-    if (pcity->is_building_unit) {
+    if (pcity->production.is_unit) {
       if (!name) {
-       id = secfile_lookup_int(file, "player%d.c%d.currently_building", 
+       id = secfile_lookup_int(file, "player%d.c%d.production.value", 
                                plrno, i);
        name = old_unit_type_name(id);
       }
-      pcity->currently_building = find_unit_type_by_name_orig(name);
+      pcity->production.value = find_unit_type_by_name_orig(name);
     } else {
       if (!name) {
-       id = secfile_lookup_int(file, "player%d.c%d.currently_building",
+       id = secfile_lookup_int(file, "player%d.c%d.production.value",
                                plrno, i);
        name = old_impr_type_name(id);
       }
-      pcity->currently_building = find_improvement_by_name_orig(name);
+      pcity->production.value = find_improvement_by_name_orig(name);
     }
 
     if (has_capability("turn_last_built", savefile_options)) {
@@ -2178,7 +2178,7 @@ static void player_load(struct player *p
       pcity->turn_last_built = 0;
     }
     pcity->changed_from_is_unit=
-      secfile_lookup_bool_default(file, pcity->is_building_unit,
+      secfile_lookup_bool_default(file, pcity->production.is_unit,
                                 "player%d.c%d.changed_from_is_unit", plrno, i);
     name = secfile_lookup_str_default(file, NULL,
                                      "player%d.c%d.changed_from_name",
@@ -3025,19 +3025,19 @@ static void player_save(struct player *p
     assert(j < sizeof(citymap_buf));
     secfile_insert_str(file, citymap_buf, "player%d.c%d.workers", plrno, i);
 
-    secfile_insert_bool(file, pcity->is_building_unit, 
-                      "player%d.c%d.is_building_unit", plrno, i);
-    if (pcity->is_building_unit) {
-      secfile_insert_int(file, old_unit_type_id(pcity->currently_building), 
-                        "player%d.c%d.currently_building", plrno, i);
-      secfile_insert_str(file, unit_name_orig(pcity->currently_building),
-                         "player%d.c%d.currently_building_name", plrno, i);
+    secfile_insert_bool(file, pcity->production.is_unit, 
+                      "player%d.c%d.production.is_unit", plrno, i);
+    if (pcity->production.is_unit) {
+      secfile_insert_int(file, old_unit_type_id(pcity->production.value), 
+                        "player%d.c%d.production.value", plrno, i);
+      secfile_insert_str(file, unit_name_orig(pcity->production.value),
+                         "player%d.c%d.production.value_name", plrno, i);
     } else {
-      secfile_insert_int(file, old_impr_type_id(pcity->currently_building),
-                         "player%d.c%d.currently_building", plrno, i);
+      secfile_insert_int(file, old_impr_type_id(pcity->production.value),
+                         "player%d.c%d.production.value", plrno, i);
       secfile_insert_str(file, get_improvement_name_orig(
-                                   pcity->currently_building),
-                         "player%d.c%d.currently_building_name", plrno, i);
+                                   pcity->production.value),
+                         "player%d.c%d.production.value_name", plrno, i);
     }
 
     /* 1.14 servers depend on improvement order in ruleset. Here we
Index: server/unithand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unithand.c,v
retrieving revision 1.343
diff -p -u -r1.343 unithand.c
--- server/unithand.c   13 Jul 2005 16:49:39 -0000      1.343
+++ server/unithand.c   14 Jul 2005 21:13:40 -0000
@@ -1194,7 +1194,7 @@ void handle_unit_help_build_wonder(struc
   notify_player_ex(pplayer, pcity_dest->tile, E_NOEVENT,
                   text, /* Must match arguments below. */
                   unit_name(punit->type),
-                  get_improvement_type(pcity_dest->currently_building)->name,
+                  get_improvement_type(pcity_dest->production.value)->name,
                   pcity_dest->name, 
                   abs(build_points_left(pcity_dest)));
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#13474) a city_production struct, Jason Short <=