Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2005:
[Freeciv-Dev] Re: (PR#12559) [Patch] is_ocean() -> can_unit_exist_at_til
Home

[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]
Subject: [Freeciv-Dev] Re: (PR#12559) [Patch] is_ocean() -> can_unit_exist_at_tile()
From: "Marko Lindqvist" <marko.lindqvist@xxxxxxxxxxx>
Date: Tue, 22 Mar 2005 09:27:22 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12559 >

Jason Short wrote:
> However the patch is buggy.  It doesn't allow any open-ground attacks by
> air units (in can_unit_attack_unit_at_tile).  I think
> can_unit_survive_at_tile doesn't do what you think it does.

  This bug was noted in my original mail :-)

  I don't think it's possible to fix that before some other changes, so 
I will just remove can_unit_attack_at_tile() changes from next version.


>        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.

> --- 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...


  - ML





[Prev in Thread] Current Thread [Next in Thread]