Index: ai/aiunit.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/aiunit.c,v retrieving revision 1.317 diff -u -r1.317 aiunit.c --- ai/aiunit.c 4 Jun 2004 15:25:13 -0000 1.317 +++ ai/aiunit.c 11 Jun 2004 13:46:04 -0000 @@ -2329,9 +2345,23 @@ int turns_horizon = FC_INFINITY; /* Future return value */ bool needed = FALSE; + struct city *mycity = map_get_city(pferry->x, pferry->y); + int ferries = 0; UNIT_LOG(LOGLEVEL_FERRY, pferry, "Ferry looking for a city that needs it"); + /* Stop yoyo-ing between cities! */ + unit_list_iterate(map_get_tile(pferry->x, pferry->y)->units, punit) { + if (unit_has_role(punit->type, L_FERRYBOAT)) { + ferries++; + } + } unit_list_iterate_end; + if (mycity && mycity->ai.choice.need_boat && ferries == 1) { + /* Staying in present city, it needs us! */ + set_goto_dest(pferry, mycity->x, mycity->y); + return TRUE; + } + pft_fill_unit_parameter(¶meter, pferry); /* We are looking for our own cities, no need to look into the unknown */ parameter.get_TB = no_fights_or_unknown;