[Freeciv-Dev] Re: (PR#12559) [Patch] is_ocean() -> can_unit_exist_at_til
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12559 >
Marko Lindqvist wrote:
>> if (ptile->city
>> || TEST_BIT(target->ai.hunted, pplayer->player_no)
>>- || (!is_ocean(ptile->terrain) && is_sailing_unit(punit))
>>- || (is_ocean(ptile->terrain) && is_ground_unit(punit))
>>+ || !can_unit_exist_at_tile(punit, ptile)
>> || (!is_sailing_unit(target) && is_sailing_unit(punit))
>> || (is_sailing_unit(target) && !is_sailing_unit(punit))
>> || !goto_is_sane(punit, target->tile, TRUE)) {
>> /* Can't hunt this one. */
>>+ /* FIXME: this prevents airplanes from hunting sailing units. */
>> continue;
>
> No, it doesn't. punit is hunter, not target. Air unit can exist at any
> tile.
The "problem" isn't in your change but in the is_sailing_unit checks.
>>--- ai/aiunit.c 21 Mar 2005 12:28:00 -0000 1.347
>>+++ ai/aiunit.c 22 Mar 2005 04:23:13 -0000
>>@@ -1745,7 +1745,7 @@
>> struct tile *ftile;
>>
>> if ((pc = dist_nearest_city(pplayer, punit->tile, FALSE, TRUE))) {
>>- if (!is_ocean(map_get_terrain(punit->tile))) {
>>+ if (can_unit_exist_at_tile(punit, punit->tile)) {
>> UNIT_LOG(LOG_DEBUG, punit, "Barbarian marching to conquer %s",
>> pc->name);
>> (void) ai_gothere(pplayer, punit, pc->tile);
>> } else {
>
>
> It might be possible that SEA_MOVING unit sometimes ends here. But
> then again, calling ai_gothere() for them (in these situations) might be
> ok...
I don't understand this.
-jason
|
|