Index: ai/aiunit.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/aiunit.c,v retrieving revision 1.230 diff -u -r1.230 aiunit.c --- ai/aiunit.c 25 Nov 2002 19:18:09 -0000 1.230 +++ ai/aiunit.c 1 Dec 2002 15:37:54 -0000 @@ -119,21 +119,22 @@ 1 if zoc_ok -1 if zoc could be ok? **************************************************************************/ -int could_unit_move_to_tile(struct unit *punit, int src_x, int src_y, - int dest_x, int dest_y) +int could_unit_move_to_tile(struct unit *punit, int dest_x, int dest_y) { enum unit_move_result result; result = test_unit_move_to_tile(punit->type, unit_owner(punit), - punit->activity, punit->connecting, - punit->x, punit->y, dest_x, dest_y, FALSE); - if (result == MR_OK) + ACTIVITY_IDLE, FALSE, punit->x, punit->y, + dest_x, dest_y, unit_flag(punit, F_IGZOC)); + if (result == MR_OK) { return 1; + } if (result == MR_ZOC) { - if (could_be_my_zoc(punit, src_x, src_y)) + if (could_be_my_zoc(punit, punit->x, punit->y)) { return -1; + } } return 0; } @@ -155,7 +156,6 @@ return FALSE; } - /********************************************************************** Precondition: A warmap must already be generated for the punit. @@ -400,8 +400,9 @@ if (map_get_continent(x1, y1) != continent) continue; - if (!can_unit_move_to_tile(punit, x1, y1, FALSE)) + if (could_unit_move_to_tile(punit, x1, y1)) { continue; + } /* We won't travel into cities, unless we are able to do so - diplomats * and caravans can. */ @@ -1044,7 +1045,7 @@ /* ...or tiny pleasant hut here! */ if (map_has_special(x1, y1, S_HUT) && best < 99999 - && could_unit_move_to_tile(punit, punit->x, punit->y, x1, y1) != 0 + && could_unit_move_to_tile(punit, x1, y1) != 0 && !is_barbarian(unit_owner(punit)) && punit->ai.ai_role != AIUNIT_ESCORT && punit->ai.charge == BODYGUARD_NONE /* Above line doesn't seem to work. :( */ @@ -1056,7 +1057,7 @@ /* If we have nothing to do, we can at least pillage something, hmm? */ if (is_land_barbarian(pplayer) && best == 0 && get_tile_infrastructure_set(map_get_tile(x1, y1)) != S_NO_SPECIAL - && could_unit_move_to_tile(punit, punit->x, punit->y, x1, y1) != 0) { + && could_unit_move_to_tile(punit, x1, y1) != 0) { SET_BEST(1); continue; } @@ -1964,7 +1965,6 @@ int dest_x, dest_y; int id = punit->id; int ct = 10; - bool igzoc = unit_flag(punit, F_IGZOC); assert(punit != NULL); if (punit->activity == ACTIVITY_GOTO) { @@ -1993,7 +1993,7 @@ repeat++; if (!is_tiles_adjacent(punit->x, punit->y, dest_x, dest_y) || !can_unit_attack_tile(punit, dest_x, dest_y) - || !can_unit_move_to_tile(punit, dest_x, dest_y, igzoc)) { + || !could_unit_move_to_tile(punit, dest_x, dest_y)) { /* Can't attack or move usually means we are adjacent but * on a ferry. This fixes the problem (usually). */ int i = ai_military_gothere(pplayer, punit, dest_x, dest_y); @@ -2598,7 +2598,7 @@ square_iterate(leader->x, leader->y, 1, x, y) { if (warmap.cost[x][y] > safest - && can_unit_move_to_tile(leader, x, y, FALSE)) { + && could_unit_move_to_tile(leader, x, y)) { safest = warmap.cost[x][y]; freelog(LOG_DEBUG, "Barbarian leader: safest is %d, %d, safeness %d", x, y, Index: ai/aiunit.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/aiunit.h,v retrieving revision 1.35 diff -u -r1.35 aiunit.h --- ai/aiunit.h 25 Nov 2002 19:18:09 -0000 1.35 +++ ai/aiunit.h 1 Dec 2002 15:37:54 -0000 @@ -40,8 +40,7 @@ extern Unit_Type_id simple_ai_types[U_LAST]; void ai_manage_units(struct player *pplayer); -int could_unit_move_to_tile(struct unit *punit, int src_x, int src_y, - int dest_x, int dest_y); +int could_unit_move_to_tile(struct unit *punit, int dest_x, int dest_y); int look_for_charge(struct player *pplayer, struct unit *punit, struct unit **aunit, struct city **acity); Index: server/citytools.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v retrieving revision 1.197 diff -u -r1.197 citytools.c --- server/citytools.c 19 Nov 2002 13:35:31 -0000 1.197 +++ server/citytools.c 1 Dec 2002 15:37:56 -0000 @@ -1167,7 +1167,7 @@ moved = FALSE; adjc_iterate(x, y, x1, y1) { if (map_get_terrain(x1, y1) == T_OCEAN) { - if (could_unit_move_to_tile(punit, x, y, x1, y1) == 1) { + if (could_unit_move_to_tile(punit, x1, y1) == 1) { moved = handle_unit_move_request(punit, x1, y1, FALSE, TRUE); if (moved) { notify_player_ex(unit_owner(punit), -1, -1, E_NOEVENT, Index: server/settlers.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/settlers.c,v retrieving revision 1.152 diff -u -r1.152 settlers.c --- server/settlers.c 14 Nov 2002 09:15:05 -0000 1.152 +++ server/settlers.c 1 Dec 2002 15:37:56 -0000 @@ -1203,8 +1203,7 @@ || (ferryboat && goto_is_sane(ferryboat, gx, gy, TRUE) && (!is_tiles_adjacent(punit->x, punit->y, gx, gy) - || could_unit_move_to_tile(punit, punit->x, punit->y, - gx, gy) == 0))) { + || could_unit_move_to_tile(punit, gx, gy) == 0))) { int x, y; punit->ai.ferryboat = find_boat(pplayer, &x, &y, 1); /* might need 2 */ freelog(LOG_DEBUG, "%d@(%d, %d): Looking for BOAT.", @@ -1233,8 +1232,7 @@ && punit->moves_left > 0 && (!ferryboat || (is_tiles_adjacent(punit->x, punit->y, gx, gy) - && could_unit_move_to_tile(punit, punit->x, punit->y, - gx, gy) != 0))) { + && could_unit_move_to_tile(punit, gx, gy) != 0))) { auto_settler_do_goto(pplayer, punit, gx, gy); if (!player_find_unit_by_id(pplayer, save_id)) return FALSE; /* died */ punit->ai.ferryboat = 0;