Index: ai/advdomestic.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/advdomestic.c,v retrieving revision 1.79 diff -u -r1.79 advdomestic.c --- ai/advdomestic.c 2002/02/12 10:08:02 1.79 +++ ai/advdomestic.c 2002/03/01 22:15:04 @@ -272,7 +272,6 @@ { struct government *g = get_gov_pcity(pcity); int i, val, t, food, j, k, hunger, bar, grana; - Impr_Type_id id, id2; int tax, prod, sci, values[B_LAST]; int est_food = pcity->food_surplus + 2 * pcity->ppl_scientist + 2 * pcity->ppl_taxman; struct player *pplayer = city_owner(pcity); @@ -496,14 +495,17 @@ /* ignored: AIRPORT, PALACE, and POLICE. -- Syela*/ /* military advisor will deal with CITY and PORT */ - for (id = 0; id < game.num_impr_types; id++) { + impr_iterate(id) { if (is_wonder(id) && could_build_improvement(pcity, id) && !wonder_obsolete(id)&& is_wonder_useful(id)) { - if (id == B_ASMITHS) - for (id2 = 0; id2 < game.num_impr_types; id2++) + if (id == B_ASMITHS) { + impr_iterate(id2) { if (city_got_building(pcity, id2) && improvement_upkeep(pcity, id2) == 1) values[id] += t; + } impr_iterate_end; + } + if (id == B_COLLOSSUS) values[id] = (pcity->size + 1) * t; /* probably underestimates the value */ if (id == B_COPERNICUS) @@ -610,9 +612,9 @@ /* ignoring APOLLO, LIGHTHOUSE, MAGELLAN, MANHATTEN, STATUE, UNITED */ } - } + } impr_iterate_end; - for (id=0;idname, get_improvement_name(id), values[id]); @@ -626,9 +628,7 @@ j = improvement_value(id); /* handle H_PROD here? -- Syela */ pcity->ai.building_want[id] = values[id] / j; - } - - return; + } impr_iterate_end; } /********************************************************************** Index: ai/aicity.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v retrieving revision 1.101 diff -u -r1.101 aicity.c --- ai/aicity.c 2002/02/19 20:03:01 1.101 +++ ai/aicity.c 2002/03/01 22:15:06 @@ -106,7 +106,6 @@ static void ai_manage_buildings(struct player *pplayer) { /* we have just managed all our cities but not chosen build for them yet */ struct government *g = get_gov_pplayer(pplayer); - Impr_Type_id i; Tech_Type_id j; int values[B_LAST], leon = 0; bool palace = FALSE; @@ -118,8 +117,10 @@ city_list_iterate(pplayer->cities, pcity) ai_eval_buildings(pcity); if (!palace) corr += pcity->corruption * 8; - for (i = 0; i < game.num_impr_types; i++) + impr_iterate(i) { if (pcity->ai.building_want[i] > 0) values[i] += pcity->ai.building_want[i]; + } impr_iterate_end; + if (pcity->ai.building_want[B_LEONARDO] > leon) leon = pcity->ai.building_want[B_LEONARDO]; city_list_iterate_end; @@ -140,7 +141,7 @@ * regression testing --dwp */ if (g->index != game.default_government && g->index != game.government_when_anarchy) { - for (i = 0; i < game.num_impr_types; i++) { + impr_iterate(i) { j = improvement_types[i].tech_req; if (get_invention(pplayer, j) != TECH_KNOWN) pplayer->ai.tech_want[j] += values[i]; @@ -151,7 +152,7 @@ /* this probably isn't right -- Syela */ /* since it assumes that the next tech is as valuable as the current -- JJCogliati */ - } + } impr_iterate_end; } /* tired of researching pottery when we need to learn Republic!! -- Syela */ @@ -175,11 +176,12 @@ city_list_iterate_end; city_list_iterate(pplayer->cities, pcity) /* wonder-kluge */ - for (i = 0; i < game.num_impr_types; i++) { + impr_iterate(i) { if (!pcity->is_building_unit && is_wonder(i) && is_wonder(pcity->currently_building)) + /* this should encourage completion of wonders, I hope! -- Syela */ pcity->ai.building_want[i] += pcity->shield_stock / 2; - } /* this should encourage completion of wonders, I hope! -- Syela */ + } impr_iterate_end; city_list_iterate_end; } @@ -317,14 +319,13 @@ **************************************************************************/ static void try_to_sell_stuff(struct player *pplayer, struct city *pcity) { - Impr_Type_id id; - for (id = 0; id < game.num_impr_types; id++) { + impr_iterate(id) { if (can_sell_building(pcity, id) && id != B_CITY) { /* selling walls to buy defenders is counterproductive -- Syela */ really_handle_city_sell(pplayer, pcity, id); break; } - } + } impr_iterate_end; } /************************************************************************** @@ -584,14 +585,13 @@ int city_get_buildings(struct city *pcity) { int b=0; - Impr_Type_id i; - for (i=0; ieconomic.gold; - Impr_Type_id id; int trade = 0, m, n, i, expense = 0, tot; int waste[40]; /* waste with N elvises */ int elvises[11] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -170,8 +169,10 @@ city_refresh(pcity); trade += pcity->trade_prod * city_tax_bonus(pcity) / 100; freelog(LOG_DEBUG, "%s has %d trade.", pcity->name, pcity->trade_prod); - for (id = 0; id < game.num_impr_types; id++) + impr_iterate(id) { if (city_got_building(pcity, id)) expense += improvement_upkeep(pcity,id); + } impr_iterate_end; + city_list_iterate_end; pplayer->ai.est_upkeep = expense; Index: ai/aitools.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/aitools.c,v retrieving revision 1.45 diff -u -r1.45 aitools.c --- ai/aitools.c 2002/02/21 09:44:50 1.45 +++ ai/aitools.c 2002/03/01 22:15:06 @@ -121,7 +121,6 @@ void ai_advisor_choose_building(struct city *pcity, struct ai_choice *choice) { /* I prefer the ai_choice as a return value; gcc prefers it as an arg -- Syela */ - Impr_Type_id i; Impr_Type_id id = B_LAST; int danger = 0, downtown = 0, cities = 0; int want=0; @@ -135,8 +134,8 @@ downtown += acity->ai.downtown; cities++; city_list_iterate_end; - - for(i=0; iis_building_unit && is_wonder(pcity->currently_building) && pcity->shield_stock >= improvement_value(i) / 2) || @@ -156,7 +155,7 @@ } } /* id is the building we like the best */ } - } + } impr_iterate_end; if (want) { freelog(LOG_DEBUG, "AI_Chosen: %s with desire = %d for %s", Index: client/climisc.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/climisc.c,v retrieving revision 1.85 diff -u -r1.85 climisc.c --- client/climisc.c 2002/02/26 19:57:06 1.85 +++ client/climisc.c 2002/03/01 22:15:09 @@ -115,7 +115,6 @@ void client_remove_city(struct city *pcity) { bool effect_update; - int i; int x=pcity->x; int y=pcity->y; @@ -125,12 +124,14 @@ /* Explicitly remove all improvements, to properly remove any global effects and to handle the preservation of "destroyed" effects. */ effect_update=FALSE; - for (i=0; iimprovements[i]!=I_NONE) { effect_update=TRUE; city_remove_improvement(pcity, i); } - } + } impr_iterate_end; + if (effect_update) update_all_effects(); @@ -870,7 +871,7 @@ { int id, cids_used = 0; - for (id = 0; id < game.num_impr_types; id++) { + impr_iterate(id) { bool can_build = can_player_build_improvement(game.player_ptr, id); bool can_eventually_build = could_player_eventually_build_improvement(game.player_ptr, id); @@ -887,7 +888,7 @@ dest_cids[cids_used] = cid_encode(FALSE, id); cids_used++; } - } + } impr_iterate_end; for (id = 0; id < game.num_unit_types; id++) { bool can_build = can_player_build_unit(game.player_ptr, id); @@ -915,16 +916,16 @@ */ int collect_cids5(cid * dest_cids, struct city *pcity) { - int id, cids_used = 0; + int cids_used = 0; assert(pcity != NULL); - for (id = 0; id < game.num_impr_types; id++) { + impr_iterate(id) { if (pcity->improvements[id] != 0) { dest_cids[cids_used] = cid_encode(FALSE, id); cids_used++; } - } + } impr_iterate_end; return cids_used; } @@ -1041,7 +1042,7 @@ } /* Now move all city improvements across. */ - for (i=0; itext = mystrdup(""); genlist_insert(&category_nodes, pitem, -1); } - } + } impr_iterate_end; } else if(current_type==HELP_WONDER) { - for(i=0; itext = mystrdup(""); genlist_insert(&category_nodes, pitem, -1); } - } + } impr_iterate_end; } else { freelog(LOG_FATAL, "Bad current_type %d", current_type); exit(EXIT_FAILURE); Index: client/gui-gtk/citydlg.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/citydlg.c,v retrieving revision 1.127 diff -u -r1.127 citydlg.c --- client/gui-gtk/citydlg.c 2002/03/01 10:22:55 1.127 +++ client/gui-gtk/citydlg.c 2002/03/01 22:15:18 @@ -1938,20 +1938,20 @@ static void city_dialog_update_improvement_list(struct city_dialog *pdialog) { - int changed, i, total, item, cids_used; + int changed, total, item, cids_used; cid cids[U_LAST + B_LAST]; struct item items[U_LAST + B_LAST]; char buf[100]; /* Test if the list improvements of pcity has changed */ changed = 0; - for (i = 0; i < game.num_impr_types; i++) { + impr_iterate(i) { if (pdialog->pcity->improvements[i] != pdialog->last_improvlist_seen[i]) { changed = 1; break; } - } + } impr_iterate_end; if (!changed) { gtk_widget_set_sensitive(pdialog->overview.sell_command, FALSE); @@ -1959,9 +1959,9 @@ } /* Update pdialog->last_improvlist_seen */ - for (i = 0; i < game.num_impr_types; i++) { + impr_iterate(i) { pdialog->last_improvlist_seen[i] = pdialog->pcity->improvements[i]; - } + } impr_iterate_end; cids_used = collect_cids5(cids, pdialog->pcity); name_and_sort_items(cids, cids_used, items, FALSE, pdialog->pcity); Index: client/gui-gtk/dialogs.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/dialogs.c,v retrieving revision 1.87 diff -u -r1.87 dialogs.c --- client/gui-gtk/dialogs.c 2002/02/11 10:37:49 1.87 +++ client/gui-gtk/dialogs.c 2002/03/01 22:15:19 @@ -774,7 +774,7 @@ struct city *pcity, int make_modal) { GtkWidget *close_command, *scrolled; - int i, j; + int j; gchar *row[1]; static gchar *title_[1] = { N_("Select Improvement to Sabotage") }; static gchar **title; @@ -828,13 +828,13 @@ gtk_clist_append(GTK_CLIST(spy_improvements_list), row); improvement_type[j++] = -1; - for(i=0; iimprovements[i] && !is_wonder(i)) { row[0] = get_impr_name_ex(pcity, i); gtk_clist_append(GTK_CLIST(spy_improvements_list), row); improvement_type[j++] = i; } - } + } impr_iterate_end; if(j > 1) { row[0] = _("At Spy's Discretion"); Index: client/gui-gtk/helpdlg.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/helpdlg.c,v retrieving revision 1.53 diff -u -r1.53 helpdlg.c --- client/gui-gtk/helpdlg.c 2002/02/16 17:28:15 1.53 +++ client/gui-gtk/helpdlg.c 2002/03/01 22:15:20 @@ -818,7 +818,7 @@ gtk_label_set_justify(GTK_LABEL(w), GTK_JUSTIFY_LEFT); gtk_container_add(GTK_CONTAINER(help_vbox), w); - for(j=0; jtech_requirement) continue; hbox = gtk_hbox_new(FALSE, 0); Index: client/gui-gtk/repodlgs.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/repodlgs.c,v retrieving revision 1.52 diff -u -r1.52 repodlgs.c --- client/gui-gtk/repodlgs.c 2002/02/25 15:24:54 1.52 +++ client/gui-gtk/repodlgs.c 2002/03/01 22:15:21 @@ -720,7 +720,7 @@ { if(delay_report_update) return; if(economy_dialog_shell) { - int j, k, count, tax, cost, total; + int k, count, tax, cost, total; char buf0 [64]; char buf1 [64]; char buf2 [64]; @@ -742,7 +742,7 @@ pcity = city_list_get(&game.player_ptr->cities,0); if(pcity) { - for (j=0;jcities,pcity) @@ -768,6 +768,8 @@ tax+=pcity->shield_surplus; } city_list_iterate_end; } + } impr_iterate_end; + my_snprintf(economy_total, sizeof(economy_total), _("Income:%6d Total Costs: %6d"), tax, total); gtk_set_label(economy_label2, economy_total); Index: common/city.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/city.c,v retrieving revision 1.152 diff -u -r1.152 city.c --- common/city.c 2002/02/26 17:13:34 1.152 +++ common/city.c 2002/03/01 22:15:23 @@ -898,10 +898,12 @@ { bool asmiths = city_affected_by_wonder(pcity, B_ASMITHS); int cost=0; - int i; - for (i=0;itax_total-cost; } Index: common/game.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/game.c,v retrieving revision 1.131 diff -u -r1.131 game.c --- common/game.c 2002/02/27 11:46:19 1.131 +++ common/game.c 2002/03/01 22:15:24 @@ -509,12 +509,12 @@ unit_list_iterate(pplayer->units, punit) if (is_military_unit(punit)) pplayer->score.units++; unit_list_iterate_end; - - for (i=0;iscore.wonders++; - } + } impr_iterate_end; /* How much should a spaceship be worth?? This gives 100 points per 10,000 citizens. --dwp @@ -766,14 +766,12 @@ ***************************************************************/ void initialize_globals(void) { - int i; - players_iterate(plr) { city_list_iterate(plr->cities, pcity) { - for (i=0;iid; - } + } impr_iterate_end; } city_list_iterate_end; } players_iterate_end; } @@ -944,11 +942,13 @@ sz_strlcpy(tthis->name_orig, tthis->name); name_strlcpy(tthis->name, Q_(tthis->name_orig)); } - for (i=0; iname_orig, tthis->name); name_strlcpy(tthis->name, Q_(tthis->name_orig)); - } + } impr_iterate_end; + for (i=T_FIRST; iterrain_name_orig, tthis->terrain_name); @@ -1030,26 +1030,24 @@ ***************************************************************/ void update_all_effects(void) { - int i; - freelog(LOG_DEBUG,"update_all_effects"); players_iterate(pplayer) { city_list_iterate(pplayer->cities,pcity) { - for (i=0;iimprovements[i]==I_NONE) continue; if (improvement_obsolete(pplayer,i)) { freelog(LOG_DEBUG,"%s in %s is obsolete", improvement_types[i].name,pcity->name); mark_improvement(pcity,i,I_OBSOLETE); } - } + } impr_iterate_end; } city_list_iterate_end; } players_iterate_end; players_iterate(pplayer) { city_list_iterate(pplayer->cities,pcity) { - for (i=0;iimprovements[i]==I_NONE || pcity->improvements[i]==I_OBSOLETE) continue; if (improvement_redundant(pplayer, pcity, i, FALSE)) { @@ -1061,7 +1059,7 @@ freelog(LOG_DEBUG,"%s in %s is active!", improvement_types[i].name,pcity->name); } - } + } impr_iterate_end; } city_list_iterate_end; } players_iterate_end; } Index: common/improvement.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/improvement.c,v retrieving revision 1.19 diff -u -r1.19 improvement.c --- common/improvement.c 2002/02/26 16:58:12 1.19 +++ common/improvement.c 2002/03/01 22:15:24 @@ -255,12 +255,11 @@ **************************************************************************/ Impr_Type_id find_improvement_by_name(char *s) { - int i; - - for( i=0; iresearch.researching != A_NONE); - - for (i=0;isize < 5) { if (can_build_improvement(pcity, B_GRANARY)) @@ -671,7 +671,7 @@ **************************************************************************/ static void raze_city(struct city *pcity) { - int i, razechance = game.razechance; + int razechance = game.razechance; /* We don't use city_remove_improvement here as the global effects stuff has already been handled by transfer_city */ @@ -681,12 +681,13 @@ if (is_land_barbarian(city_owner(pcity))) razechance += 30; - for (i=0;iimprovements[i]=I_NONE; } - } + } impr_iterate_end; + nullify_prechange_production(pcity); pcity->shield_stock = 0; } @@ -780,12 +781,12 @@ /* Remove all global improvement effects that this city confers (but then restore the local improvement list - we need this to restore the global effects for the new city owner) */ - for (i=0;iimprovements[i]!=I_NONE) { city_remove_improvement(pcity,i); pcity->improvements[i]=I_ACTIVE; } - } + } impr_iterate_end; give_citymap_from_player_to_player(pcity, pgiver, ptaker); map_unfog_pseudo_city_area(ptaker, pcity->x, pcity->y); @@ -863,11 +864,11 @@ raze_city(pcity); /* Restore any global improvement effects that this city confers */ - for (i=0;iimprovements[i]!=I_NONE) { city_add_improvement(pcity,i); } - } + } impr_iterate_end; update_all_effects(); /* If the city was building something we haven't invented we @@ -1061,7 +1062,6 @@ int o, x, y; struct player *pplayer = city_owner(pcity); struct tile *ptile = map_get_tile(pcity->x, pcity->y); - int i; bool effect_update, had_palace = pcity->improvements[B_PALACE] != I_NONE; char *city_name = strdup(pcity->name); @@ -1072,12 +1072,14 @@ /* Explicitly remove all improvements, to properly remove any global effects and to handle the preservation of "destroyed" effects. */ effect_update=FALSE; - for (i=0;iimprovements[i]!=I_NONE) { effect_update=TRUE; city_remove_improvement(pcity,i); } - } + } impr_iterate_end; + if (effect_update) update_all_effects(); @@ -1596,8 +1598,11 @@ *p='\0'; p=packet->improvements; - for(i=0; icurrently_building=i; pcity->is_building_unit = FALSE; return FALSE; } + } impr_iterate_end; + return FALSE; } @@ -1087,8 +1087,7 @@ **************************************************************************/ static void pay_for_buildings(struct player *pplayer, struct city *pcity) { - int i; - for (i=0; igovernment != game.government_when_anarchy) { @@ -1103,7 +1102,7 @@ pplayer->economic.gold -= improvement_upkeep(pcity, i); } } - } + } impr_iterate_end; } /************************************************************************** Index: server/diplomats.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/diplomats.c,v retrieving revision 1.23 diff -u -r1.23 diplomats.c --- server/diplomats.c 2002/02/27 11:12:50 1.23 +++ server/diplomats.c 2002/03/01 22:15:35 @@ -202,13 +202,15 @@ struct city *pcity) { struct packet_sabotage_list packet; - int i; char *p; /* Send city improvements info to player. */ p = packet.improvements; - for(i=0; iid; packet.city_id = pcity->id; @@ -846,7 +848,7 @@ struct city *pcity, int improvement) { struct player *cplayer; - int index, count, which, target; + int count, which, target; char *prod; struct city *capital; @@ -890,12 +892,12 @@ /* Examine the city for improvements to sabotage. */ count = 0; - for (index = 0; index < game.num_impr_types; index++) { + impr_iterate(index) { if (city_got_building (pcity, index) && (!is_wonder (index)) && (index != B_PALACE)) { count++; } - } + } impr_iterate_end; freelog (LOG_DEBUG, "sabotage: count of improvements: %d", count); @@ -927,7 +929,8 @@ } else { target = -1; which = myrand (count); - for (index = 0; index < game.num_impr_types; index++) { + + impr_iterate(index) { if (city_got_building (pcity, index) && (!is_wonder (index)) && (index != B_PALACE)) { if (which > 0) { @@ -937,7 +940,8 @@ break; } } - } + } impr_iterate_end; + freelog (LOG_DEBUG, "sabotage: random: targeted improvement: %d (%s)", target, get_improvement_name (target)); } Index: server/plrhand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v retrieving revision 1.220 diff -u -r1.220 plrhand.c --- server/plrhand.c 2002/02/27 11:12:51 1.220 +++ server/plrhand.c 2002/03/01 22:15:37 @@ -216,7 +216,6 @@ bool bonus_tech_hack = FALSE; bool was_first = FALSE; int saved_bulbs; - int wonder; struct city *pcity; plr->got_tech = TRUE; @@ -229,7 +228,7 @@ advances[tech_found].name); /* Alert the owners of any wonders that have been made obsolete */ - for (wonder = 0; wonder < game.num_impr_types; wonder++) { + impr_iterate(wonder) { if (game.global_wonders[wonder] != 0 && is_wonder(wonder) && improvement_types[wonder].obsolete_by == tech_found && (pcity = find_city_by_id(game.global_wonders[wonder]))) { @@ -238,7 +237,7 @@ advances[tech_found].name, get_improvement_name(wonder), pcity->name); } - } + } impr_iterate_end; } for (i=0; icities, pcity2) { @@ -242,7 +245,8 @@ } city_list_iterate_end; } players_iterate_end; } - } + } impr_iterate_end; + page_conn(dest, _("Traveler's Report:"), _("Wonders of the World"), buffer); } Index: server/ruleset.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v retrieving revision 1.98 diff -u -r1.98 ruleset.c --- server/ruleset.c 2002/02/27 11:12:52 1.98 +++ server/ruleset.c 2002/03/01 22:15:40 @@ -879,7 +879,7 @@ static void load_building_names(struct section_file *file) { char **sec; - int nval, i; + int nval; const char *filename = secfile_filename(file); section_file_lookup(file,"datafile.description"); /* unused */ @@ -904,11 +904,12 @@ /* REMOVE TO HERE when gen-impr implemented. */ game.num_impr_types = nval; - for (i = 0; i < game.num_impr_types; i++) { + impr_iterate(i) { char *name = secfile_lookup_str(file, "%s.name", sec[i]); name_strlcpy(improvement_types[i].name, name); improvement_types[i].name_orig[0] = 0; - } + } impr_iterate_end; + free(sec); } @@ -1190,7 +1191,7 @@ } /* Some more consistency checking: */ - for (i = 0; i < game.num_impr_types; i++) { + impr_iterate(i) { b = &improvement_types[i]; if (improvement_exists(i)) { if (!tech_exists(b->tech_req)) { @@ -1215,7 +1216,7 @@ } } } - } + } impr_iterate_end; /* FIXME: remove all of the following when gen-impr implemented... */ @@ -2355,11 +2356,11 @@ **************************************************************************/ static void send_ruleset_buildings(struct conn_list *dest) { - struct packet_ruleset_building packet; - struct impr_type *b; + impr_iterate(i) { + struct impr_type *b = &improvement_types[i]; + struct packet_ruleset_building packet; - for(b=improvement_types; bname_orig); packet.tech_req = b->tech_req; packet.bldg_req = b->bldg_req; @@ -2378,7 +2379,7 @@ packet.helptext = b->helptext; /* pointer assignment */ lsend_packet_ruleset_building(dest, &packet); - } + } impr_iterate_end; } /************************************************************************** Index: server/rulesout.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/rulesout.c,v retrieving revision 1.8 diff -u -r1.8 rulesout.c --- server/rulesout.c 2002/02/14 15:17:37 1.8 +++ server/rulesout.c 2002/03/01 22:15:40 @@ -114,7 +114,7 @@ } /* Improvements and Wonders */ - for(j=0; jtech_req == itech) { if (it->is_wonder ) { @@ -125,7 +125,7 @@ sz_strlcat(buf, it->name); secfile_insert_str(file, buf, "%s.effect%d", prefix, ieffect++); } - } + } impr_iterate_end; /* Obsoleted units: */ for(j=0; jobsolete_by == itech) { if (it->is_wonder ) { @@ -153,7 +153,7 @@ sz_strlcat(buf, it->name); secfile_insert_str(file, buf, "%s.effect%d", prefix, ieffect++); } - } + } impr_iterate_end; /* Flags: */ for (j = 0; j < ARRAY_SIZE(tech_flag_desc); j++) { Index: server/savegame.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v retrieving revision 1.66 diff -u -r1.66 savegame.c --- server/savegame.c 2002/02/27 11:46:21 1.66 +++ server/savegame.c 2002/03/01 22:15:42 @@ -889,11 +889,11 @@ /* Initialise city's vector of improvement effects. */ ceff_vector_init(&pcity->effects); - for(x=0; xworklist); if (has_capability("worklists2", savefile_options)) { @@ -1490,9 +1490,10 @@ secfile_insert_int(file, pcity->currently_building, "player%d.c%d.currently_building", plrno, i); - for(j=0; jimprovements[j] != I_NONE) ? '1' : '0'; - buf[j]='\0'; + impr_iterate(id) { + buf[id] = (pcity->improvements[id] != I_NONE) ? '1' : '0'; + } impr_iterate_end; + buf[game.num_impr_types] = '\0'; secfile_insert_str(file, buf, "player%d.c%d.improvements", plrno, i); worklist_save(file, "player%d.c%d", plrno, i, &pcity->worklist); @@ -1984,11 +1985,15 @@ if (!game.is_new_game && game.load_options.load_players) { /* destroyed wonders: */ string = secfile_lookup_str_default(file, "", "game.destroyed_wonders"); - for (i = 0; i < game.num_impr_types && string[i] != '\0'; i++) { + impr_iterate(i) { + if (string[i] == '\0') { + goto out; + } if (string[i] == '1') { game.global_wonders[i] = -1; /* destroyed! */ } - } + } impr_iterate_end; + out: for(i=0; i