diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/ai/aiunit.c workdir/ai/aiunit.c --- freeciv/ai/aiunit.c Sat May 20 18:06:55 2000 +++ workdir/ai/aiunit.c Sat May 20 19:12:59 2000 @@ -763,7 +763,7 @@ punit->goto_dest_x = dest_x; punit->goto_dest_y = dest_y; set_unit_activity(punit, ACTIVITY_SENTRY); /* anything but GOTO!! */ - if (!is_transporter_with_free_space(pplayer, punit->x, punit->y)) { + if (ground_unit_transporter_capacity(punit->x, punit->y, pplayer->player_no) <= 0) { freelog(LOG_DEBUG, "All aboard!"); /* perhaps this should only require two passengers */ unit_list_iterate(ptile->units, mypass) @@ -1555,7 +1555,7 @@ unit_list_iterate(pplayer->units, aunit) /* if (aunit->ai.ferryboat == punit->id && warmap.seacost[aunit->x][aunit->y] < best) {*/ if (aunit->ai.ferryboat && warmap.seacost[aunit->x][aunit->y] < best && - !is_transporter_with_free_space(pplayer, aunit->x, aunit->y) && + ground_unit_transporter_capacity(aunit->x, aunit->y, pplayer->player_no) <= 0 && ai_fuzzy(pplayer,1)) { freelog(LOG_DEBUG, "Found a friend %d@(%d, %d)", aunit->id, aunit->x, aunit->y); diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/common/unit.c workdir/common/unit.c --- freeciv/common/unit.c Sat May 20 18:07:20 2000 +++ workdir/common/unit.c Sat May 20 19:04:52 2000 @@ -259,29 +259,6 @@ } /************************************************************************** -Check for any free space on pplayer's transporters at (x,y). -(Return number of units which may be added to transporters to fill them.) -**************************************************************************/ -int is_transporter_with_free_space(struct player *pplayer, int x, int y) -{ - struct tile *ptile = map_get_tile(x, y); - int availability = 0; - - unit_list_iterate(map_get_tile(x, y)->units, punit) { - if (punit->owner == pplayer->player_no) { - if (is_ground_units_transport(punit) - && !(is_ground_unit(punit) && ptile->terrain == T_OCEAN)) - availability += get_transporter_capacity(punit); - else if (is_ground_unit(punit)) - availability--; - } - } - unit_list_iterate_end; - - return (availability > 0 ? availability : 0); -} - -/************************************************************************** Returns the number of free spaces for ground units. Can be 0 or negative. **************************************************************************/ int ground_unit_transporter_capacity(int x, int y, int playerid) diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/common/unit.h workdir/common/unit.h --- freeciv/common/unit.h Sat May 20 18:07:20 2000 +++ workdir/common/unit.h Sat May 20 19:05:16 2000 @@ -293,7 +293,6 @@ struct unit_type *get_unit_type(Unit_Type_id id); char *unit_activity_text(struct unit *punit); char *unit_description(struct unit *punit); -int is_transporter_with_free_space(struct player *pplayer, int x, int y); int ground_unit_transporter_capacity(int x, int y, int playerid); int get_transporter_capacity(struct unit *punit); int is_ground_units_transport(struct unit *punit); diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/server/gotohand.c workdir/server/gotohand.c --- freeciv/server/gotohand.c Sat May 20 18:07:28 2000 +++ workdir/server/gotohand.c Sat May 20 19:14:17 2000 @@ -172,7 +172,7 @@ if (which == LAND_MOVING) { /* if (tile0->move_cost[k] == -3 || tile0->move_cost[k] > 16) c = maxcost;*/ if (map_get_terrain(x1, y1) == T_OCEAN) { - if (punit && is_transporter_with_free_space(pplayer, x1, y1)) c = 3; + if (punit && ground_unit_transporter_capacity(x1, y1, pplayer->player_no) > 0) c = 3; else c = maxcost; } else if (tile0->terrain == T_OCEAN) c = 3; else if (igter) c = 3; /* NOT c = 1 */ @@ -400,7 +400,7 @@ if(is_ground_unit(punit)) { /* Check condition 4 */ if(ptile->terrain==T_OCEAN && - !is_transporter_with_free_space(&game.players[punit->owner], x, y)) + ground_unit_transporter_capacity(x, y, punit->owner) <= 0) return 0; /* Moving from ocean */ @@ -933,7 +933,7 @@ if (is_ground_unit(punit) && (omni || map_get_known_and_seen(x, y, pplayer->player_no))) { if (map_get_terrain(x, y) == T_OCEAN) { - if (is_transporter_with_free_space(pplayer, x, y)) { + if (ground_unit_transporter_capacity(x, y, pplayer->player_no) > 0) { for (k = 0; k < 8; k++) { if (map_get_continent(punit->x, punit->y) == map_get_continent(x + ii[k], y + jj[k])) diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/server/settlers.c workdir/server/settlers.c --- freeciv/server/settlers.c Sat May 20 18:07:28 2000 +++ workdir/server/settlers.c Sat May 20 19:04:18 2000 @@ -765,7 +765,7 @@ if (is_ground_units_transport(aunit)) { if (warmap.cost[aunit->x][aunit->y] < best && (warmap.cost[aunit->x][aunit->y] == 0 || - is_transporter_with_free_space(pplayer, aunit->x, aunit->y) >= cap)) { + ground_unit_transporter_capacity(aunit->x, aunit->y, pplayer->player_no) >= cap)) { id = aunit->id; best = warmap.cost[aunit->x][aunit->y]; *x = aunit->x; diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/server/unittools.c workdir/server/unittools.c --- freeciv/server/unittools.c Sat May 20 18:07:28 2000 +++ workdir/server/unittools.c Sat May 20 19:07:47 2000 @@ -77,7 +77,7 @@ if(is_ground_unit(punit)) { /* Check condition 4 */ if(ptile->terrain==T_OCEAN && - !is_transporter_with_free_space(&game.players[punit->owner], x, y)) + ground_unit_transporter_capacity(x, y, punit->owner) <= 0) return 0; /* Moving from ocean */ if(ptile2->terrain==T_OCEAN) {