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 22:27:46 2001 @@ -144,7 +144,7 @@ m = unit_types[punit->type].move_rate; if (unit_flag(punit->type, F_IGTER)) m *= SINGLE_MOVE; if(is_sailing_unit(punit)) { - struct player *pplayer = get_player(punit->owner); + struct player *pplayer = unit_owner(punit); if (player_owns_active_wonder(pplayer, B_LIGHTHOUSE)) m += SINGLE_MOVE; if (player_owns_active_wonder(pplayer, B_MAGELLAN)) @@ -572,7 +572,7 @@ if (!d) return 1; /* Thanks, Markus -- Syela */ cur = unit_belligerence_primitive(aunit) * get_virtual_defense_power(punit->type, pdef->type, pdef->x, pdef->y) / d; - if (cur > val && ai_fuzzy(get_player(punit->owner),1)) return(0); + if (cur > val && ai_fuzzy(unit_owner(punit),1)) return(0); unit_list_iterate_end; } } @@ -1442,7 +1442,7 @@ static int find_nearest_friendly_port(struct unit *punit) { - struct player *pplayer = get_player(punit->owner); + struct player *pplayer = unit_owner(punit); int best = 6 * THRESHOLD + 1, cur; generate_warmap(map_get_city(punit->x, punit->y), punit); city_list_iterate(pplayer->cities, pcity) diff -Nurd -X work/diff_ignore freeciv.current/client/climisc.c work/client/climisc.c --- freeciv.current/client/climisc.c Tue Apr 24 14:25:31 2001 +++ work/client/climisc.c Thu Aug 23 22:28:12 2001 @@ -74,7 +74,7 @@ struct unit *ufocus = get_unit_in_focus(); freelog(LOG_DEBUG, "removing unit %d, %s %s (%d %d) hcity %d", - unit_id, get_nation_name(get_player(punit->owner)->nation), + unit_id, get_nation_name(unit_owner(punit)->nation), unit_name(punit->type), punit->x, punit->y, hc); if(punit==ufocus) { diff -Nurd -X work/diff_ignore freeciv.current/client/gui-gtk/mapview.c work/client/gui-gtk/mapview.c --- freeciv.current/client/gui-gtk/mapview.c Mon Aug 20 09:30:01 2001 +++ work/client/gui-gtk/mapview.c Thu Aug 23 22:29:06 2001 @@ -1607,7 +1607,7 @@ int i; if (solid_bg) { - gtk_pixcomm_fill(p, colors_standard[player_color(get_player(punit->owner))], + gtk_pixcomm_fill(p, colors_standard[player_color(unit_owner(punit))], FALSE); } 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 22:28:33 2001 @@ -923,7 +923,7 @@ unit_list_insert(&pcity->units_supported, punit); freelog(LOG_DEBUG, "New %s %s id %d (%d %d) hc %d %s", - get_nation_name(get_player(punit->owner)->nation), + get_nation_name(unit_owner(punit)->nation), unit_name(punit->type), punit->x, punit->y, punit->id, punit->homecity, (pcity ? pcity->name : _("(unknown)"))); diff -Nurd -X work/diff_ignore freeciv.current/common/city.c work/common/city.c --- freeciv.current/common/city.c Thu Aug 23 09:02:58 2001 +++ work/common/city.c Thu Aug 23 22:31:03 2001 @@ -838,8 +838,7 @@ if (id==B_MANHATTEN) return (game.global_wonders[id] != 0); - tmp = player_find_city_by_id(get_player(pcity->owner), - game.global_wonders[id]); + tmp = player_find_city_by_id(city_owner(pcity), game.global_wonders[id]); if (!tmp) return 0; switch (id) { 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 22:31:54 2001 @@ -624,10 +624,10 @@ struct city *pcity; freelog(LOG_DEBUG, "removing unit %d, %s %s (%d %d) hcity %d", - unit_id, get_nation_name(get_player(punit->owner)->nation), + unit_id, get_nation_name(unit_owner(punit)->nation), unit_name(punit->type), punit->x, punit->y, punit->homecity); - pcity=player_find_city_by_id(get_player(punit->owner), punit->homecity); + pcity=player_find_city_by_id(unit_owner(punit), punit->homecity); if(pcity) unit_list_unlink(&pcity->units_supported, punit); 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 22:32:31 2001 @@ -472,7 +472,7 @@ **************************************************************************/ int can_unit_do_connect (struct unit *punit, enum unit_activity activity) { - struct player *pplayer = get_player (punit->owner); + struct player *pplayer = unit_owner(punit); if (!unit_flag(punit->type, F_SETTLERS)) return 0; diff -Nurd -X work/diff_ignore freeciv.current/server/autoattack.c work/server/autoattack.c --- freeciv.current/server/autoattack.c Thu May 31 17:02:56 2001 +++ work/server/autoattack.c Thu Aug 23 22:33:04 2001 @@ -153,11 +153,10 @@ if (debug) freelog(LOG_DEBUG, "launching attack"); - notify_player_ex(pplayer, enemy->x,enemy->y, E_NOEVENT, - "Game: Auto-Attack: %s's %s attacking %s's %s", - pcity->name, unit_name(punit->type), - get_player(enemy->owner)->name, - unit_name(enemy->type)); + notify_player_ex(pplayer, enemy->x, enemy->y, E_NOEVENT, + "Game: Auto-Attack: %s's %s attacking %s's %s", + pcity->name, unit_name(punit->type), + unit_owner(enemy)->name, unit_name(enemy->type)); set_unit_activity(punit, ACTIVITY_GOTO); punit->goto_dest_x=enemy->x; diff -Nurd -X work/diff_ignore freeciv.current/server/cityturn.c work/server/cityturn.c --- freeciv.current/server/cityturn.c Thu Aug 23 09:03:04 2001 +++ work/server/cityturn.c Thu Aug 23 22:33:22 2001 @@ -1738,7 +1738,7 @@ **************************************************************************/ static int disband_city(struct city *pcity) { - struct player *pplayer = get_player(pcity->owner); + struct player *pplayer = city_owner(pcity); int x = pcity->x, y = pcity->y; struct city *rcity=NULL; diff -Nurd -X work/diff_ignore freeciv.current/server/diplomats.c work/server/diplomats.c --- freeciv.current/server/diplomats.c Thu Aug 23 09:03:04 2001 +++ work/server/diplomats.c Thu Aug 23 22:39:46 2001 @@ -334,7 +334,7 @@ /* Fetch target unit's player. Sanity checks. */ if (!pvictim) return; - uplayer = get_player (pvictim->owner); + uplayer = unit_owner(pvictim); if (uplayer == NULL || pplayers_allied(pplayer, uplayer)) return; @@ -346,11 +346,10 @@ /* If unit has too few hp, can't sabotage. */ if (pvictim->hp < 2) { - notify_player_ex (pplayer, pvictim->x, pvictim->y, E_MY_DIPLOMAT, - _("Game: Your %s could not sabotage %s's %s."), - unit_name (pdiplomat->type), - get_player (pvictim->owner)->name, - unit_name (pvictim->type)); + notify_player_ex(pplayer, pvictim->x, pvictim->y, E_MY_DIPLOMAT, + _("Game: Your %s could not sabotage %s's %s."), + unit_name(pdiplomat->type), + unit_owner(pvictim)->name, unit_name(pvictim->type)); freelog (LOG_DEBUG, "sabotage-unit: unit has too few hit points"); return; } @@ -362,11 +361,10 @@ send_unit_info (0, pvictim); /* Notify everybody involved. */ - notify_player_ex (pplayer, pvictim->x, pvictim->y, E_MY_DIPLOMAT, - _("Game: Your %s succeeded in sabotaging %s's %s."), - unit_name (pdiplomat->type), - get_player (pvictim->owner)->name, - unit_name (pvictim->type)); + notify_player_ex(pplayer, pvictim->x, pvictim->y, E_MY_DIPLOMAT, + _("Game: Your %s succeeded in sabotaging %s's %s."), + unit_name(pdiplomat->type), + unit_owner(pvictim)->name, unit_name(pvictim->type)); notify_player_ex (uplayer, pvictim->x, pvictim->y, E_DIPLOMATED, _("Game: Your %s was sabotaged by %s!"), unit_name (pvictim->type), pplayer->name); @@ -402,7 +400,7 @@ /* Fetch target unit's player. Sanity checks. */ if (!pvictim) return; - uplayer = get_player(pvictim->owner); + uplayer = unit_owner(pvictim); /* We might make it allowable in peace with a liss of reputaion */ if (uplayer == NULL || pplayers_allied(pplayer, uplayer)) return; @@ -426,11 +424,10 @@ /* If player doesn't have enough gold, can't bribe. */ if (pplayer->economic.gold < pvictim->bribe_cost) { - notify_player_ex (pplayer, pdiplomat->x, pdiplomat->y, E_MY_DIPLOMAT, - _("Game: You don't have enough gold to" - " bribe %s's %s."), - get_player (pvictim->owner)->name, - unit_name (pvictim->type)); + notify_player_ex(pplayer, pdiplomat->x, pdiplomat->y, E_MY_DIPLOMAT, + _("Game: You don't have enough gold to" + " bribe %s's %s."), + unit_owner(pvictim)->name, unit_name(pvictim->type)); freelog (LOG_DEBUG, "bribe-unit: not enough gold"); return; } @@ -443,11 +440,10 @@ pvictim->moves_left, pvictim->hp); /* Notify everybody involved. */ - notify_player_ex (pplayer, pvictim->x, pvictim->y, E_MY_DIPLOMAT, - _("Game: Your %s succeeded in bribing %s's %s."), - unit_name (pdiplomat->type), - get_player (pvictim->owner)->name, - unit_name (pvictim->type)); + notify_player_ex(pplayer, pvictim->x, pvictim->y, E_MY_DIPLOMAT, + _("Game: Your %s succeeded in bribing %s's %s."), + unit_name(pdiplomat->type), + unit_owner(pvictim)->name, unit_name(pvictim->type)); notify_player_ex (uplayer, pvictim->x, pvictim->y, E_DIPLOMATED, _("Game: Your %s was bribed by %s."), unit_name (pvictim->type), pplayer->name); diff -Nurd -X work/diff_ignore freeciv.current/server/gotohand.c work/server/gotohand.c --- freeciv.current/server/gotohand.c Thu Aug 23 12:28:57 2001 +++ work/server/gotohand.c Thu Aug 23 22:40:14 2001 @@ -954,7 +954,7 @@ int nearland; struct city *pcity; struct unit *passenger; - struct player *pplayer = get_player(punit->owner); + struct player *pplayer = unit_owner(punit); if (map_get_terrain(punit->x, punit->y) == T_OCEAN) passenger = other_passengers(punit); diff -Nurd -X work/diff_ignore freeciv.current/server/unithand.c work/server/unithand.c --- freeciv.current/server/unithand.c Wed Aug 8 11:46:26 2001 +++ work/server/unithand.c Thu Aug 23 22:45:02 2001 @@ -675,44 +675,40 @@ game.players[pdefender->owner].name, unit_types[pdefender->type].name); - notify_player_ex(get_player(pwinner->owner), - pwinner->x, pwinner->y, E_UNIT_WIN, + notify_player_ex(unit_owner(pwinner), + pwinner->x, pwinner->y, E_UNIT_WIN, _("Game: Your %s%s survived the pathetic attack" - " from %s's %s."), - unit_name(pwinner->type), - get_location_str_in(get_player(pwinner->owner), + " from %s's %s."), + unit_name(pwinner->type), + get_location_str_in(unit_owner(pwinner), pwinner->x, pwinner->y), - get_player(plooser->owner)->name, - unit_name(plooser->type)); + unit_owner(plooser)->name, unit_name(plooser->type)); - notify_player_ex(get_player(plooser->owner), - def_x, def_y, E_UNIT_LOST_ATT, - _("Game: Your attacking %s failed against %s's %s%s!"), - unit_name(plooser->type), - get_player(pwinner->owner)->name, + notify_player_ex(unit_owner(plooser), + def_x, def_y, E_UNIT_LOST_ATT, + _ + ("Game: Your attacking %s failed against %s's %s%s!"), + unit_name(plooser->type), unit_owner(pwinner)->name, unit_name(pwinner->type), - get_location_str_at(get_player(plooser->owner), + get_location_str_at(unit_owner(plooser), pwinner->x, pwinner->y)); wipe_unit(plooser); } else { /* The defender lost, the attacker punit lives! */ freelog(LOG_DEBUG, "Defender lost: %s's %s against %s's %s.", - pplayer->name, unit_types[punit->type].name, - game.players[pdefender->owner].name, - unit_types[pdefender->type].name); + pplayer->name, unit_types[punit->type].name, + unit_owner(pdefender)->name, unit_types[pdefender->type].name); punit->moved=1; /* We moved */ - notify_player_ex(get_player(pwinner->owner), - punit->x, punit->y, E_UNIT_WIN_ATT, + notify_player_ex(unit_owner(pwinner), punit->x, punit->y, + E_UNIT_WIN_ATT, _("Game: Your attacking %s succeeded" - " against %s's %s%s!"), - unit_name(pwinner->type), - get_player(plooser->owner)->name, - unit_name(plooser->type), - get_location_str_at(get_player(pwinner->owner), - plooser->x, plooser->y)); + " against %s's %s%s!"), unit_name(pwinner->type), + unit_owner(plooser)->name, unit_name(plooser->type), + get_location_str_at(unit_owner(pwinner), plooser->x, + plooser->y)); kill_unit(pwinner, plooser); /* no longer pplayer - want better msgs -- Syela */ } diff -Nurd -X work/diff_ignore freeciv.current/server/unittools.c work/server/unittools.c --- freeciv.current/server/unittools.c Fri Aug 17 01:04:26 2001 +++ work/server/unittools.c Thu Aug 23 22:50:13 2001 @@ -170,12 +170,12 @@ **************************************************************************/ void maybe_make_veteran(struct unit *punit) { - if (punit->veteran) - return; - if(player_owns_active_wonder(get_player(punit->owner), B_SUNTZU)) - punit->veteran = 1; - else - punit->veteran=myrand(2); + if (punit->veteran) + return; + if (player_owns_active_wonder(unit_owner(punit), B_SUNTZU)) + punit->veteran = 1; + else + punit->veteran = myrand(2); } /************************************************************************** @@ -1313,7 +1313,7 @@ int enemies_at(struct unit *punit, int x, int y) { int a = 0, d, db; - struct player *pplayer = get_player(punit->owner); + struct player *pplayer = unit_owner(punit); struct city *pcity = map_get_tile(x,y)->city; if (pcity && pcity->owner == punit->owner) @@ -1344,10 +1344,10 @@ static void disband_stack_conflict_unit(struct unit *punit, int verbose) { freelog(LOG_VERBOSE, "Disbanded %s's %s at (%d, %d)", - get_player(punit->owner)->name, unit_name(punit->type), + unit_owner(punit)->name, unit_name(punit->type), punit->x, punit->y); if (verbose) { - notify_player(get_player(punit->owner), + notify_player(unit_owner(punit), _("Game: Disbanded your %s at (%d, %d)."), unit_name(punit->type), punit->x, punit->y); } @@ -1429,7 +1429,7 @@ if (!cunit) break; - ccity = find_closest_owned_city(get_player(cunit->owner), x, y, + ccity = find_closest_owned_city(unit_owner(cunit), x, y, is_sailing_unit(cunit), NULL); if (pcity && ccity) { @@ -1477,8 +1477,8 @@ if (ground_unit_transporter_capacity(x, y, punit->owner) < 0) { unit_list_iterate(ptile->units, wunit) { if (is_ground_unit(wunit) && wunit->owner == vunit->owner) { - struct city *wcity = - find_closest_owned_city(get_player(wunit->owner), x, y, 0, NULL); + struct city *wcity = + find_closest_owned_city(unit_owner(wunit), x, y, 0, NULL); if (wcity) teleport_unit_to_city(wunit, wcity, 0, verbose); else @@ -1709,11 +1709,11 @@ if (phomecity) { city_refresh(phomecity); - send_city_info(get_player(phomecity->owner), phomecity); + send_city_info(city_owner(phomecity), phomecity); } if (pcity && pcity != phomecity) { city_refresh(pcity); - send_city_info(get_player(pcity->owner), pcity); + send_city_info(city_owner(pcity), pcity); } } @@ -1791,8 +1791,8 @@ void kill_unit(struct unit *pkiller, struct unit *punit) { struct city *incity = map_get_city(punit->x, punit->y); - struct player *pplayer = get_player(punit->owner); - struct player *destroyer = get_player(pkiller->owner); + struct player *pplayer = unit_owner(punit); + struct player *destroyer = unit_owner(pkiller); char *loc_str = get_location_str_in(pplayer, punit->x, punit->y); int num_killed[MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS]; int ransom, unitcount = 0; @@ -1870,7 +1870,7 @@ get_unit_type(punit2->type)->name, destroyer->name, unit_name(pkiller->type)); gamelog(GAMELOG_UNITL, "%s lose %s to the %s", - get_nation_name_plural(get_player(punit2->owner)->nation), + get_nation_name_plural(unit_owner(punit2)->nation), get_unit_type(punit2->type)->name, get_nation_name_plural(destroyer->nation)); wipe_unit_spec_safe(punit2, NULL, 0); @@ -1880,11 +1880,6 @@ } } - - - - - /************************************************************************** ... **************************************************************************/ @@ -2710,7 +2705,7 @@ struct city *fromcity = map_get_city(src_x, src_y); struct city *tocity = map_get_city(dest_x, dest_y); struct city *homecity = NULL; - struct player *pplayer = get_player(punit->owner); + struct player *pplayer = unit_owner(punit); /* struct government *g = get_gov_pplayer(pplayer);*/ int senthome = 0; if (punit->homecity)