[freeciv-ai] Re: ai_military_attack()
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Mon, 26 Aug 2002, Jordi Negrevernis i Font wrote:
> >+static struct unit *ai_military_rampage(struct unit *punit, int threshold)
> >+{
> >+int x, y, id = punit->id;
> >+
> >+while (punit && punit->moves_left
> >+ && ai_military_findvictim(punit, &x, &y) >= threshold) {
> >+ ai_unit_attack(punit, x, y);
> >+ punit = find_unit_by_id(id);
> >+}
> >+return punit;
> >+}
> >
> Be aware that this code does not check to see if the coordinates
> returned by ai_military_findvictim are the same as the unit ones. You
> shouldhave to check that they are diferent or i'll have an assert in
> ai_unit_attack...
As far as I am aware, that should not happen. findvictim should only
return a positive value if it found something to attack _and_ has set
&x, &y to an adjacent tile... am I mistaken?
Yours
Per
|
|