diff -Nurd -X work/diff_ignore freeciv.current/ai/advmilitary.c work/ai/advmilitary.c --- freeciv.current/ai/advmilitary.c Wed Jun 20 17:25:02 2001 +++ work/ai/advmilitary.c Thu Aug 23 22:57:55 2001 @@ -248,7 +248,7 @@ struct unit *funit = &virtualunit; /* saves me a lot of typing. -- Syela */ memset(&virtualunit, 0, sizeof(struct unit)); - pplayer = &game.players[pcity->owner]; + pplayer = city_owner(pcity); generate_warmap(pcity, 0); /* generates both land and sea maps */ diff -Nurd -X work/diff_ignore freeciv.current/ai/aitools.c work/ai/aitools.c --- freeciv.current/ai/aitools.c Tue Apr 10 14:43:59 2001 +++ work/ai/aitools.c Thu Aug 23 22:58:26 2001 @@ -129,7 +129,7 @@ int want=0; struct player *plr; - plr = &game.players[pcity->owner]; + plr = city_owner(pcity); /* too bad plr->score isn't kept up to date. */ city_list_iterate(plr->cities, acity) diff -Nurd -X work/diff_ignore freeciv.current/ai/aiunit.c work/ai/aiunit.c --- freeciv.current/ai/aiunit.c Mon Aug 13 16:09:26 2001 +++ work/ai/aiunit.c Thu Aug 23 23:01:43 2001 @@ -633,10 +633,9 @@ unit_list_size(&(map_get_tile(punit->x, punit->y)->units)) < 2 && get_total_attack_power(patt, punit)) { freelog(LOG_DEBUG, "%s defending %s from %s's %s", - get_unit_type(punit->type)->name, - map_get_city(x, y)->name, - game.players[pdef->owner].name, - get_unit_type(pdef->type)->name); + get_unit_type(punit->type)->name, + map_get_city(x, y)->name, + unit_owner(pdef)->name, get_unit_type(pdef->type)->name); } else { a = reinforcements_value(punit, pdef->x, pdef->y); a += unit_belligerence_primitive(punit); @@ -670,7 +669,7 @@ } if (map_get_tile(x1, y1)->special & S_HUT && best < 99999 && could_unit_move_to_tile(punit, punit->x, punit->y, x1, y1) && - !is_barbarian(&game.players[punit->owner]) && + !is_barbarian(unit_owner(punit)) && /* zoc_ok_move(punit, x1, y1) && !is_sailing_unit(punit) &&*/ punit->ai.ai_role != AIUNIT_ESCORT && /* makes life easier */ !punit->ai.charge && /* above line seems not to work. :( */ diff -Nurd -X work/diff_ignore freeciv.current/client/gui-gtk/mapctrl.c work/client/gui-gtk/mapctrl.c --- freeciv.current/client/gui-gtk/mapctrl.c Fri Jun 29 21:39:02 2001 +++ work/client/gui-gtk/mapctrl.c Thu Aug 23 23:04:33 2001 @@ -132,8 +132,8 @@ } if((pcity=map_get_city(xtile, ytile))) { - my_snprintf(s, sizeof(s), _("City: %s(%s)"), pcity->name, - get_nation_name(game.players[pcity->owner].nation)); + my_snprintf(s, sizeof(s), _("City: %s(%s)"), pcity->name, + get_nation_name(city_owner(pcity)->nation)); gtk_widget_new(GTK_TYPE_LABEL, "GtkWidget::parent", b, "GtkLabel::label", s, NULL); @@ -166,8 +166,8 @@ if(pcity) my_snprintf(cn, sizeof(cn), "/%s", pcity->name); } - my_snprintf(s, sizeof(s), _("Unit: %s(%s%s)"), ptype->name, - get_nation_name(game.players[punit->owner].nation), cn); + my_snprintf(s, sizeof(s), _("Unit: %s(%s%s)"), ptype->name, + get_nation_name(unit_owner(punit)->nation), cn); gtk_widget_new(GTK_TYPE_LABEL, "GtkWidget::parent", b, "GtkLabel::label", s, NULL); diff -Nurd -X work/diff_ignore freeciv.current/client/gui-mui/mapclass.c work/client/gui-mui/mapclass.c --- freeciv.current/client/gui-mui/mapclass.c Wed Aug 22 09:47:19 2001 +++ work/client/gui-mui/mapclass.c Thu Aug 23 23:05:24 2001 @@ -140,7 +140,8 @@ if ((pcity = map_get_city(xtile, ytile))) { - my_snprintf(s, sizeof(s), _("City: %s(%s)"), pcity->name, get_nation_name(game.players[pcity->owner].nation)); + my_snprintf(s, sizeof(s), _("City: %s(%s)"), pcity->name, + get_nation_name(city_owner(pcity)->nation)); text_obj = TextObject, MUIA_Text_Contents, s, End; if(text_obj) @@ -173,7 +174,8 @@ if (pcity) my_snprintf(cn, sizeof(cn), "/%s", pcity->name); } - my_snprintf(s, sizeof(s), _("Unit: %s(%s%s)"), ptype->name, get_nation_name(game.players[punit->owner].nation), cn); + my_snprintf(s, sizeof(s), _("Unit: %s(%s%s)"), ptype->name, + get_nation_name(unit_owner(punit)->nation), cn); text_obj = TextObject, MUIA_Text_Contents, s, End; DoMethod(group, OM_ADDMEMBER, text_obj); diff -Nurd -X work/diff_ignore freeciv.current/client/gui-xaw/mapctrl.c work/client/gui-xaw/mapctrl.c --- freeciv.current/client/gui-xaw/mapctrl.c Fri Jun 29 21:39:04 2001 +++ work/client/gui-xaw/mapctrl.c Thu Aug 23 23:06:12 2001 @@ -128,9 +128,9 @@ } if((pcity=map_get_city(xtile, ytile))) { - my_snprintf(s, sizeof(s), _("City: %s(%s) %s"), pcity->name, - get_nation_name(game.players[pcity->owner].nation), - city_got_citywalls(pcity) ? _("with City Walls") : ""); + my_snprintf(s, sizeof(s), _("City: %s(%s) %s"), pcity->name, + get_nation_name(city_owner(pcity)->nation), + city_got_citywalls(pcity) ? _("with City Walls") : ""); XtCreateManagedWidget(s, smeBSBObjectClass, p, NULL, 0); } @@ -150,8 +150,8 @@ if(pcity) my_snprintf(cn, sizeof(cn), "/%s", pcity->name); } - my_snprintf(s, sizeof(s), _("Unit: %s(%s%s)"), ptype->name, - get_nation_name(game.players[punit->owner].nation), cn); + my_snprintf(s, sizeof(s), _("Unit: %s(%s%s)"), ptype->name, + get_nation_name(unit_owner(punit)->nation), cn); XtCreateManagedWidget(s, smeBSBObjectClass, p, NULL, 0); if(punit->owner==game.player_idx) { diff -Nurd -X work/diff_ignore freeciv.current/client/packhand.c work/client/packhand.c --- freeciv.current/client/packhand.c Thu Aug 23 09:02:56 2001 +++ work/client/packhand.c Thu Aug 23 23:01:12 2001 @@ -425,7 +425,7 @@ unit_list_init(&pcity->units_supported); unit_list_init(&pcity->info_units_supported); unit_list_init(&pcity->info_units_present); - city_list_insert(&game.players[pcity->owner].cities, pcity); + city_list_insert(city_owner(pcity)->cities, pcity); map_set_city(pcity->x, pcity->y, pcity); if(pcity->owner==game.player_idx) city_report_dialog_update(); @@ -766,7 +766,7 @@ repaint_unit = 0; repaint_city = 0; - punit = player_find_unit_by_id(&game.players[packet->owner], packet->id); + punit = player_find_unit_by_id(get_player(packet->owner), packet->id); if(punit) { int dest_x,dest_y; @@ -916,7 +916,7 @@ punit->activity_count=0; /* never used in client/ or common/ --dwp */ - unit_list_insert(&game.players[packet->owner].units, punit); + unit_list_insert(get_player(packet->owner)->units, punit); unit_list_insert(&map_get_tile(punit->x, punit->y)->units, punit); if((pcity=find_city_by_id(punit->homecity))) diff -Nurd -X work/diff_ignore freeciv.current/client/tilespec.c work/client/tilespec.c --- freeciv.current/client/tilespec.c Mon Aug 13 18:31:19 2001 +++ work/client/tilespec.c Thu Aug 23 23:02:52 2001 @@ -801,7 +801,7 @@ ***********************************************************************/ static struct Sprite *get_city_nation_flag_sprite(struct city *pcity) { - return get_nation_by_plr(&game.players[pcity->owner])->flag_sprite; + return get_nation_by_plr(city_owner(pcity))->flag_sprite; } /********************************************************************** @@ -809,7 +809,7 @@ ***********************************************************************/ static struct Sprite *get_unit_nation_flag_sprite(struct unit *punit) { - return get_nation_by_plr(&game.players[punit->owner])->flag_sprite; + return get_nation_by_plr(unit_owner(punit))->flag_sprite; } /************************************************************************** diff -Nurd -X work/diff_ignore freeciv.current/common/combat.c work/common/combat.c --- freeciv.current/common/combat.c Sun Jul 15 23:11:01 2001 +++ work/common/combat.c Thu Aug 23 23:06:57 2001 @@ -477,7 +477,7 @@ struct unit *debug_unit = unit_list_get(&map_get_tile(x, y)->units, 0); freelog(LOG_ERROR, "Get_def bugged at (%d,%d). The most likely course" " is a unit on an ocean square without a transport. The owner" - " of the unit is %s", x, y, game.players[debug_unit->owner].name); + " of the unit is %s", x, y, unit_owner(debug_unit)->name); } return bestdef; diff -Nurd -X work/diff_ignore freeciv.current/common/game.c work/common/game.c --- freeciv.current/common/game.c Thu Aug 23 09:02:58 2001 +++ work/common/game.c Thu Aug 23 23:07:41 2001 @@ -637,7 +637,7 @@ } unit_list_unlink(&map_get_tile(punit->x, punit->y)->units, punit); - unit_list_unlink(&game.players[punit->owner].units, punit); + unit_list_unlink(unit_owner(punit)->units, punit); idex_unregister_unit(punit); @@ -659,7 +659,7 @@ city_map_iterate(x,y) { set_worker_city(pcity, x, y, C_TILE_EMPTY); } city_map_iterate_end; - city_list_unlink(&game.players[pcity->owner].cities, pcity); + city_list_unlink(city_owner(pcity)->cities, pcity); map_set_city(pcity->x, pcity->y, NULL); idex_unregister_city(pcity); free(pcity->worklist); diff -Nurd -X work/diff_ignore freeciv.current/common/unit.c work/common/unit.c --- freeciv.current/common/unit.c Mon Aug 13 16:09:34 2001 +++ work/common/unit.c Thu Aug 23 23:10:19 2001 @@ -39,8 +39,8 @@ int unit_move_rate(struct unit *punit) { int val; - struct player *pplayer; - pplayer = &game.players[punit->owner]; + struct player *pplayer = unit_owner(punit); + val = get_unit_type(punit->type)->move_rate; if (!is_air_unit(punit) && !is_heli_unit(punit)) val = (val * punit->hp) / get_unit_type(punit->type)->hp; @@ -113,10 +113,8 @@ return players_at_war(playerid, pcity->owner); if(action==DIPLOMAT_MOVE) return players_allied(playerid, pcity->owner); - if(action==DIPLOMAT_EMBASSY && - !is_barbarian(&game.players[pcity->owner]) && - !player_has_embassy(&game.players[pdiplomat->owner], - &game.players[pcity->owner])) + if (action == DIPLOMAT_EMBASSY && !is_barbarian(city_owner(pcity)) && + !player_has_embassy(unit_owner(pdiplomat), city_owner(pcity))) return 1; if(action==SPY_POISON && pcity->size>1 && @@ -124,8 +122,8 @@ return players_at_war(playerid, pcity->owner); if(action==DIPLOMAT_INVESTIGATE) return 1; - if(action==DIPLOMAT_STEAL && !is_barbarian(&game.players[pcity->owner])) - return 1; + if (action == DIPLOMAT_STEAL && !is_barbarian(city_owner(pcity))) + return 1; if(action==DIPLOMAT_INCITE) return !players_allied(pcity->owner, pdiplomat->owner); if(action==DIPLOMAT_ANY_ACTION) @@ -599,7 +597,7 @@ struct tile *ptile; struct tile_type *type; - pplayer = &game.players[punit->owner]; + pplayer = unit_owner(punit); ptile = map_get_tile(punit->x, punit->y); type = get_tile_type(ptile->terrain); diff -Nurd -X work/diff_ignore freeciv.current/server/barbarian.c work/server/barbarian.c --- freeciv.current/server/barbarian.c Thu May 24 23:18:07 2001 +++ work/server/barbarian.c Thu Aug 23 23:11:04 2001 @@ -329,7 +329,7 @@ if( !(pc = dist_nearest_city(NULL, x, y, 1, 0)) ) /* any city */ return; - victim = &game.players[pc->owner]; + victim = city_owner(pc); dist = real_map_distance(x, y, pc->x, pc->y); freelog(LOG_DEBUG,"Closest city to %d %d is %s at %d %d which is %d far", diff -Nurd -X work/diff_ignore freeciv.current/server/citytools.c work/server/citytools.c --- freeciv.current/server/citytools.c Thu Aug 23 09:03:04 2001 +++ work/server/citytools.c Thu Aug 23 23:14:47 2001 @@ -164,12 +164,12 @@ **************************************************************************/ int get_temple_power(struct city *pcity) { - struct player *p=&game.players[pcity->owner]; - int power=1; - if (get_invention(p, game.rtech.temple_plus)==TECH_KNOWN) - power=2; - if (city_affected_by_wonder(pcity, B_ORACLE)) - power*=2; + struct player *p = city_owner(pcity); + int power = 1; + if (get_invention(p, game.rtech.temple_plus) == TECH_KNOWN) + power = 2; + if (city_affected_by_wonder(pcity, B_ORACLE)) + power *= 2; return power; } @@ -178,14 +178,16 @@ **************************************************************************/ int get_cathedral_power(struct city *pcity) { - struct player *p=&game.players[pcity->owner]; + struct player *p = city_owner(pcity); int power = 3; - if (get_invention(p, game.rtech.cathedral_minus/*A_COMMUNISM*/) == TECH_KNOWN) - power--; - if (get_invention(p, game.rtech.cathedral_plus/*A_THEOLOGY*/) == TECH_KNOWN) - power++; - if (improvement_variant(B_MICHELANGELO)==1 && city_affected_by_wonder(pcity, B_MICHELANGELO)) - power*=2; + + if (get_invention(p, game.rtech.cathedral_minus /*A_COMMUNISM */ ) == + TECH_KNOWN) power--; + if (get_invention(p, game.rtech.cathedral_plus /*A_THEOLOGY */ ) == + TECH_KNOWN) power++; + if (improvement_variant(B_MICHELANGELO) == 1 + && city_affected_by_wonder(pcity, B_MICHELANGELO)) + power *= 2; return power; } @@ -194,10 +196,11 @@ **************************************************************************/ int get_colosseum_power(struct city *pcity) { + struct player *p = city_owner(pcity); int power = 3; - struct player *p=&game.players[pcity->owner]; - if (get_invention(p, game.rtech.colosseum_plus/*A_ELECTRICITY*/) == TECH_KNOWN) - power++; + + if (get_invention(p, game.rtech.colosseum_plus /*A_ELECTRICITY */ ) == + TECH_KNOWN) power++; return power; } @@ -788,7 +791,7 @@ pcity->improvements[B_PALACE]=I_NONE; /* land barbarians are more likely to destroy city improvements */ - if( is_land_barbarian(&game.players[pcity->owner]) ) + if (is_land_barbarian(city_owner(pcity))) razechance += 30; for (i=0;ix, pcity->y, E_CITY_LOST, _("Game: %s has been destroyed by %s."), pcity->name, pplayer->name); - gamelog(GAMELOG_LOSEC,"%s (%s) (%i,%i) destroyed by %s", - pcity->name, - get_nation_name(game.players[pcity->owner].nation), - pcity->x,pcity->y, + gamelog(GAMELOG_LOSEC, "%s (%s) (%i,%i) destroyed by %s", pcity->name, + get_nation_name(city_owner(pcity)->nation), pcity->x, pcity->y, get_nation_name_plural(pplayer->nation)); remove_city_from_minimap(pcity->x, pcity->y); remove_city(pcity); @@ -1285,12 +1286,9 @@ _("Game: %s conquered %s and looted %d gold" " from the city."), pplayer->name, pcity->name, coins); - gamelog(GAMELOG_CONQ, "%s (%s) (%i,%i) conquered by %s", - pcity->name, - get_nation_name(game.players[pcity->owner].nation), - pcity->x,pcity->y, - get_nation_name_plural(pplayer->nation)); - + gamelog(GAMELOG_CONQ, "%s (%s) (%i,%i) conquered by %s", pcity->name, + get_nation_name(city_owner(pcity)->nation), pcity->x, pcity->y, + get_nation_name_plural(pplayer->nation)); } else { notify_player_ex(pplayer, pcity->x, pcity->y, E_NOEVENT, _("Game: You have liberated %s!!" @@ -1301,10 +1299,8 @@ _("Game: %s liberated %s and looted %d gold" " from the city."), pplayer->name, pcity->name, coins); - gamelog(GAMELOG_CONQ, "%s (%s) (%i,%i) liberated by %s", - pcity->name, - get_nation_name(game.players[pcity->owner].nation), - pcity->x,pcity->y, + gamelog(GAMELOG_CONQ, "%s (%s) (%i,%i) liberated by %s", pcity->name, + get_nation_name(city_owner(pcity)->nation), pcity->x, pcity->y, get_nation_name_plural(pplayer->nation)); }