[Freeciv-Dev] (PR#13474) a city_production struct
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13474 >
Here is an updated patch. After some testing and review I hope to
commit this one. This shouldn't be considered the final design but it's
a step in the right direction.
-jason
Index: ai/advdiplomacy.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdiplomacy.c,v
retrieving revision 1.85
diff -p -u -r1.85 advdiplomacy.c
--- ai/advdiplomacy.c 22 Jul 2005 16:18:04 -0000 1.85
+++ ai/advdiplomacy.c 24 Jul 2005 00:40:26 -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(get_unit_type(pcity->currently_building),
+ if (pcity->production.is_unit
+ && unit_type_flag(get_unit_type(pcity->production.value),
F_CITIES)) {
kill_desire -= 1;
}
Index: ai/advdomestic.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdomestic.c,v
retrieving revision 1.135
diff -p -u -r1.135 advdomestic.c
--- ai/advdomestic.c 22 Jul 2005 16:18:04 -0000 1.135
+++ ai/advdomestic.c 24 Jul 2005 00:40:26 -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(get_unit_type(acity->currently_building),
+ if (acity->production.is_unit
+ && unit_type_flag(get_unit_type(acity->production.value),
F_HELP_WONDER)
&& tile_get_continent(acity->tile) == continent) {
caravans++;
@@ -103,12 +103,12 @@ 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 /
unit_type->move_rate;
- assert(!wonder_city->is_building_unit);
+ assert(!wonder_city->production.is_unit);
want /= MAX(dist, 1);
CITY_LOG(LOG_DEBUG, pcity, "want %s to help wonder in %s with %d",
Index: ai/aicity.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v
retrieving revision 1.231
diff -p -u -r1.231 aicity.c
--- ai/aicity.c 22 Jul 2005 16:18:04 -0000 1.231
+++ ai/aicity.c 24 Jul 2005 00:40:26 -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.23
diff -p -u -r1.23 aiferry.c
--- ai/aiferry.c 22 Jul 2005 16:18:04 -0000 1.23
+++ ai/aiferry.c 24 Jul 2005 00:40:27 -0000
@@ -769,18 +769,18 @@ static bool aiferry_find_interested_city
if (pcity && pcity->owner == pferry->owner
&& (pcity->ai.choice.need_boat
- || (pcity->is_building_unit
- && unit_has_role(get_unit_type(pcity->currently_building),
+ || (pcity->production.is_unit
+ && unit_has_role(get_unit_type(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(get_unit_type(pcity->currently_building),
+ if (pos.turn > turns && pcity->production.is_unit
+ && unit_has_role(get_unit_type(pcity->production.value),
L_FERRYBOAT)) {
UNIT_LOG(LOGLEVEL_FERRY, pferry, "%s is NOT suitable: "
"will finish building its own ferry too soon", pcity->name);
Index: client/citydlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/citydlg_common.c,v
retrieving revision 1.82
diff -p -u -r1.82 citydlg_common.c
--- client/citydlg_common.c 22 Jul 2005 16:18:04 -0000 1.82
+++ client/citydlg_common.c 24 Jul 2005 00:40:27 -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(get_unit_type(pcity->currently_building));
+ if (pcity->production.is_unit) {
+ cost = unit_build_shield_cost(get_unit_type(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) {
@@ -646,8 +646,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;
}
@@ -765,8 +765,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);
}
@@ -813,7 +813,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.52
diff -p -u -r1.52 cityrepdata.c
--- client/cityrepdata.c 22 Jul 2005 16:18:04 -0000 1.52
+++ client/cityrepdata.c 24 Jul 2005 00:40:27 -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(get_unit_type(pcity->currently_building));
+ if(pcity->production.is_unit) {
+ name = get_unit_type(pcity->production.value)->name;
+ cost = unit_build_shield_cost(get_unit_type(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.170
diff -p -u -r1.170 climisc.c
--- client/climisc.c 22 Jul 2005 16:18:04 -0000 1.170
+++ client/climisc.c 24 Jul 2005 00:40:27 -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, get_unit_type(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);
}
/**************************************************************************
@@ -1074,10 +1074,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;
@@ -1089,10 +1089,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.58
diff -p -u -r1.58 mapctrl_common.c
--- client/mapctrl_common.c 23 Jul 2005 18:02:44 -0000 1.58
+++ client/mapctrl_common.c 24 Jul 2005 00:40:27 -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 24 Jul 2005 00:40:28 -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.537
diff -p -u -r1.537 packhand.c
--- client/packhand.c 22 Jul 2005 16:18:05 -0000 1.537
+++ client/packhand.c 24 Jul 2005 00:40:28 -0000
@@ -409,8 +409,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;
@@ -460,12 +460,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);
@@ -718,8 +718,8 @@ void handle_city_short_info(struct packe
pcity->shield_stock = 0;
pcity->pollution = 0;
BV_CLR_ALL(pcity->city_options);
- 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.32
diff -p -u -r1.32 cma_fec.c
--- client/agents/cma_fec.c 22 Jul 2005 16:18:05 -0000 1.32
+++ client/agents/cma_fec.c 24 Jul 2005 00:40:28 -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(get_unit_type(pcity->currently_building));
+ if (pcity->production.is_unit) {
+ cost = unit_build_shield_cost(get_unit_type(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 24 Jul 2005 00:40:28 -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.133
diff -p -u -r1.133 citydlg.c
--- client/gui-gtk-2.0/citydlg.c 23 Jul 2005 00:59:33 -0000 1.133
+++ client/gui-gtk-2.0/citydlg.c 24 Jul 2005 00:40:29 -0000
@@ -1490,12 +1490,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(get_unit_type(pcity->currently_building));
- descr = get_unit_type(pcity->currently_building)->name;
+ if (pcity->production.is_unit) {
+ cost = unit_build_shield_cost(get_unit_type(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) {
@@ -2378,12 +2378,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.74
diff -p -u -r1.74 cityrep.c
--- client/gui-gtk-2.0/cityrep.c 16 Jul 2005 09:04:53 -0000 1.74
+++ client/gui-gtk-2.0/cityrep.c 24 Jul 2005 00:40:29 -0000
@@ -976,11 +976,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.113
diff -p -u -r1.113 dialogs.c
--- client/gui-gtk-2.0/dialogs.c 18 Jul 2005 22:46:27 -0000 1.113
+++ client/gui-gtk-2.0/dialogs.c 24 Jul 2005 00:40:29 -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.93
diff -p -u -r1.93 repodlgs.c
--- client/gui-gtk-2.0/repodlgs.c 22 Jul 2005 16:18:05 -0000 1.93
+++ client/gui-gtk-2.0/repodlgs.c 24 Jul 2005 00:40:29 -0000
@@ -1223,8 +1223,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 24 Jul 2005 00:40:30 -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 24 Jul 2005 00:40:30 -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 24 Jul 2005 00:40:30 -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 24 Jul 2005 00:40:31 -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 24 Jul 2005 00:40:31 -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 24 Jul 2005 00:40:31 -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 24 Jul 2005 00:40:32 -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 24 Jul 2005 00:40:32 -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 24 Jul 2005 00:40:33 -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.51
diff -p -u -r1.51 repodlgs.c
--- client/gui-win32/repodlgs.c 20 Jul 2005 07:19:20 -0000 1.51
+++ client/gui-win32/repodlgs.c 24 Jul 2005 00:40:33 -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 24 Jul 2005 00:40:33 -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 24 Jul 2005 00:40:33 -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 24 Jul 2005 00:40:34 -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 24 Jul 2005 00:40:34 -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.357
diff -p -u -r1.357 city.c
--- common/city.c 22 Jul 2005 16:18:05 -0000 1.357
+++ common/city.c 24 Jul 2005 00:40:34 -0000
@@ -371,11 +371,11 @@ int city_buy_cost(const struct city *pci
{
int cost, build = pcity->shield_stock;
- if (pcity->is_building_unit) {
- cost = unit_buy_gold_cost(get_unit_type(pcity->currently_building),
+ if (pcity->production.is_unit) {
+ cost = unit_buy_gold_cost(get_unit_type(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;
}
@@ -2409,8 +2409,8 @@ struct city *create_city_virtual(struct
struct unit_type *u = best_role_unit(pcity, L_FIRSTBUILD);
if (u) {
- pcity->is_building_unit = TRUE;
- pcity->currently_building = u->index;
+ pcity->production.is_unit = TRUE;
+ pcity->production.value = u->index;
} else {
bool found = FALSE;
@@ -2419,8 +2419,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;
@@ -2429,8 +2429,8 @@ struct city *create_city_virtual(struct
unit_type_iterate(punittype) {
if (can_build_unit_direct(pcity, punittype)) {
found = TRUE;
- pcity->is_building_unit = TRUE;
- pcity->currently_building = punittype->index;
+ pcity->production.is_unit = TRUE;
+ pcity->production.value = punittype->index;
}
} unit_type_iterate_end;
}
@@ -2444,8 +2444,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.218
diff -p -u -r1.218 city.h
--- common/city.h 22 Jul 2005 16:18:05 -0000 1.218
+++ common/city.h 24 Jul 2005 00:40:34 -0000
@@ -131,6 +131,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 };
@@ -240,10 +245,9 @@ 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];
struct worklist worklist;
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 24 Jul 2005 00:40:35 -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.145
diff -p -u -r1.145 packets.def
--- common/packets.def 22 Jul 2005 15:37:35 -0000 1.145
+++ common/packets.def 24 Jul 2005 00:40:35 -0000
@@ -511,8 +511,8 @@ PACKET_CITY_INFO=21; 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/unit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unit.c,v
retrieving revision 1.247
diff -p -u -r1.247 unit.c
--- common/unit.c 22 Jul 2005 16:18:06 -0000 1.247
+++ common/unit.c 24 Jul 2005 00:40:35 -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 24 Jul 2005 00:40:35 -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.150
diff -p -u -r1.150 cityhand.c
--- server/cityhand.c 23 Jul 2005 18:02:44 -0000 1.150
+++ server/cityhand.c 24 Jul 2005 00:40:36 -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 = get_unit_type(pcity->currently_building)->name;
- total = unit_build_shield_cost(get_unit_type(pcity->currently_building));
+ if (pcity->production.is_unit) {
+ name = get_unit_type(pcity->production.value)->name;
+ total = unit_build_shield_cost(get_unit_type(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.338
diff -p -u -r1.338 citytools.c
--- server/citytools.c 23 Jul 2005 18:02:44 -0000 1.338
+++ server/citytools.c 24 Jul 2005 00:40:36 -0000
@@ -461,7 +461,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;
}
@@ -872,11 +872,11 @@ void transfer_city(struct player *ptaker
} built_impr_iterate_end;
/* Set production to something valid for pplayer, if not. */
- if ((pcity->is_building_unit
+ if ((pcity->production.is_unit
&& !can_build_unit_direct(pcity,
- get_unit_type(pcity->currently_building)))
- || (!pcity->is_building_unit
- && !can_build_improvement(pcity, pcity->currently_building))) {
+ get_unit_type(pcity->production.value)))
+ || (!pcity->production.is_unit
+ && !can_build_improvement(pcity, pcity->production.value))) {
advisor_choose_build(ptaker, pcity);
}
@@ -1569,8 +1569,8 @@ void package_city(struct city *pcity, st
packet->pollution=pcity->pollution;
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;
@@ -1787,13 +1787,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 --
@@ -1802,7 +1802,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);
}
@@ -1811,14 +1811,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 = get_unit_type(pcity->currently_building)->name;
+ name = get_unit_type(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;
@@ -1845,11 +1845,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.324
diff -p -u -r1.324 cityturn.c
--- server/cityturn.c 22 Jul 2005 16:18:06 -0000 1.324
+++ server/cityturn.c 24 Jul 2005 00:40:36 -0000
@@ -294,15 +294,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;
@@ -326,7 +326,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 */
@@ -336,7 +336,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);
}
}
@@ -470,7 +470,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."),
@@ -873,12 +873,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(get_unit_type(pcity->currently_building), F_UNIQUE)) {
+ if (!unit_type_flag(get_unit_type(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;
}
@@ -920,15 +920,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;
}
}
@@ -966,11 +966,11 @@ static struct unit_type *unit_upgrades_t
static void upgrade_unit_prod(struct city *pcity)
{
struct player *pplayer = city_owner(pcity);
- struct unit_type *id = get_unit_type(pcity->currently_building);
+ struct unit_type *id = get_unit_type(pcity->production.value);
struct unit_type *id2 = unit_upgrades_to(pcity, id);
if (id2 && can_build_unit_direct(pcity, id2)) {
- pcity->currently_building = id2->index;
+ pcity->production.value = id2->index;
notify_player_ex(pplayer, pcity->tile, E_UNIT_UPGRADED,
_("Production of %s is upgraded to %s in %s."),
id->name, id2->name,
@@ -1039,7 +1039,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) {
@@ -1164,7 +1164,7 @@ 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
@@ -1228,7 +1228,7 @@ static bool city_build_unit(struct playe
/* TRANS: <city> is finished building <unit/building>. */
_("%s is finished building %s."),
pcity->name,
- get_unit_type(pcity->currently_building)->name);
+ get_unit_type(pcity->production.value)->name);
script_signal_emit("unit_built",
2, API_TYPE_UNIT, punit, API_TYPE_CITY, pcity);
@@ -1253,7 +1253,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);
@@ -1408,8 +1408,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",
@@ -1528,7 +1528,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);
@@ -1561,7 +1561,7 @@ static bool disband_city(struct city *pc
/* TRANS: Settler production leads to disbanded city. */
_("%s is disbanded into %s."),
pcity->name,
- get_unit_type(pcity->currently_building)->name);
+ get_unit_type(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.88
diff -p -u -r1.88 diplomats.c
--- server/diplomats.c 22 Jul 2005 16:18:06 -0000 1.88
+++ server/diplomats.c 24 Jul 2005 00:40:36 -0000
@@ -929,10 +929,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(get_unit_type(pcity->currently_building));
+ if (pcity->production.is_unit)
+ prod = unit_name(get_unit_type(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.52
diff -p -u -r1.52 gamelog.c
--- server/gamelog.c 23 Jul 2005 18:02:44 -0000 1.52
+++ server/gamelog.c 24 Jul 2005 00:40:37 -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
- ? get_unit_type(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
+ ? get_unit_type(pcity->production.value)->name
+ : get_impr_name_ex(pcity, pcity->production.value),
get_nation_name_plural(city_owner(pcity)->nation),
- 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),
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.68
diff -p -u -r1.68 report.c
--- server/report.c 22 Jul 2005 15:39:33 -0000 1.68
+++ server/report.c 24 Jul 2005 00:40:37 -0000
@@ -307,7 +307,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.268
diff -p -u -r1.268 savegame.c
--- server/savegame.c 22 Jul 2005 16:18:06 -0000 1.268
+++ server/savegame.c 24 Jul 2005 00:40:38 -0000
@@ -2154,26 +2154,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)->index;
+ pcity->production.value = find_unit_type_by_name_orig(name)->index;
} 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)) {
@@ -2185,7 +2185,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",
@@ -3048,20 +3048,20 @@ 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) {
- struct unit_type *punittype = get_unit_type(pcity->currently_building);
+ secfile_insert_bool(file, pcity->production.is_unit,
+ "player%d.c%d.production.is_unit", plrno, i);
+ if (pcity->production.is_unit) {
+ struct unit_type *punittype = get_unit_type(pcity->production.value);
secfile_insert_int(file, old_unit_type_id(punittype),
- "player%d.c%d.currently_building", plrno, i);
+ "player%d.c%d.production.value", plrno, i);
secfile_insert_str(file, unit_name_orig(punittype),
- "player%d.c%d.currently_building_name", plrno, i);
+ "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.345
diff -p -u -r1.345 unithand.c
--- server/unithand.c 22 Jul 2005 16:18:08 -0000 1.345
+++ server/unithand.c 24 Jul 2005 00:40:38 -0000
@@ -1197,7 +1197,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)));
- [Freeciv-Dev] Re: (PR#13474) a city_production struct, (continued)
- [Freeciv-Dev] Re: (PR#13474) a city_production struct, Jason Short, 2005/07/14
- [Freeciv-Dev] Re: (PR#13474) a city_production struct, Vasco Alexandre da Silva Costa, 2005/07/15
- [Freeciv-Dev] Re: (PR#13474) a city_production struct, Vasco Alexandre da Silva Costa, 2005/07/15
- [Freeciv-Dev] Re: (PR#13474) a city_production struct, Benoit Hudson, 2005/07/15
- [Freeciv-Dev] Re: (PR#13474) a city_production struct, Jason Short, 2005/07/15
- [Freeciv-Dev] Re: (PR#13474) a city_production struct, Jason Short, 2005/07/15
- [Freeciv-Dev] Re: (PR#13474) a city_production struct, Vasco Alexandre da Silva Costa, 2005/07/16
- [Freeciv-Dev] Re: (PR#13474) a city_production struct, Jason Short, 2005/07/17
- [Freeciv-Dev] Re: (PR#13474) a city_production struct, Vasco Alexandre da Silva Costa, 2005/07/18
- [Freeciv-Dev] Re: (PR#13474) a city_production struct, Jason Short, 2005/07/18
- [Freeciv-Dev] (PR#13474) a city_production struct,
Jason Short <=
|
|