Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2003:
[Freeciv-Dev] Re: (PR#4188) get_defender() given illegal combat options
Home

[Freeciv-Dev] Re: (PR#4188) get_defender() given illegal combat options

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: per@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#4188) get_defender() given illegal combat options
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Wed, 7 May 2003 13:59:21 -0700
Reply-to: rt@xxxxxxxxxxxxxx

On Wed, 7 May 2003, Per I. Mathisen wrote:

> 
> ai/aiunit.c, find_something_to_kill():
> 
>      if (!(aunit == get_defender(punit, aunit->x, aunit->y))) {
>         /* It's not the main defender */
>         continue;
>       }
> 
> This can attempt to make a defender in illegal conditions, which in turn
> leads to an assert failure in get_defender().

Failure of which assert?  Asserts inget_defender ain't easy to fail...

> One solution is to remove the error checking from get_defender(). I don't
> find that a good idea.
> 
> Another is to make a wrapping function for get_defender() for the AI for
> whenever we use it virtually.
> 
> But best of all, I think we can just add a call to
> can_unit_attack_unit_at_tile() to the above mess.

this is the best of the three, but I am not sure if there is a need for 
any fix at all...

G.





[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Re: (PR#4188) get_defender() given illegal combat options, Gregory Berkolaiko <=