Complete.Org: Mailing Lists: Archives: freeciv-ai: December 2002:
[freeciv-ai] Re: (PR#2634) ai_military_attack() bug#2
Home

[freeciv-ai] Re: (PR#2634) ai_military_attack() bug#2

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: per@xxxxxxxxxxx
Cc: freeciv-ai@xxxxxxxxxxx
Subject: [freeciv-ai] Re: (PR#2634) ai_military_attack() bug#2
From: "Gregory Berkolaiko via RT" <rt@xxxxxxxxxxxxxx>
Date: Mon, 23 Dec 2002 12:50:58 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Mon, 23 Dec 2002, Per I. Mathisen via RT wrote:

> Looks good, except for one thing:
> 
> --- ai/aitools.c      2002/12/21 11:44:00     1.68
> +++ ai/aitools.c      2002/12/23 19:07:23
> @@ -285,12 +286,14 @@
>    pmove.unid = punit->id;
>    handle_unit_activity_request(punit, ACTIVITY_IDLE);
>    handle_move_unit(unit_owner(punit), &pmove);
> +  alive = (find_unit_by_id(sanity) != NULL);
> 
> -  if (find_unit_by_id(sanity) && same_pos(x, y, punit->x, punit->y)) {
> -    if (has_bodyguard(punit)) {
> -      ai_unit_bodyguard_move(punit->ai.bodyguard, x, y);
> -    }
> +  if (alive && same_pos(x, y, punit->x, punit->y)
> +      && has_bodyguard(punit)) {
> +    ai_unit_bodyguard_move(punit->ai.bodyguard, x, y);
>    }
> +
> +  return alive;
> 
> With autoattack, it is theoretically possible that an autoattack
> counterstrike won't be launched against punit, but will be against our
> bodyguard, so that we're dead by the time we return TRUE...
> 
> There are more issues like this. Should I post them separately or as part
> of the autoattack patch?

Wow, you look far :))

Do you want me to commit this and then actually do the autoattack-related 
checks before or together with actual autoattack?

G.

P.S. My patch doesn't introduce any _new_ bugs, even taking into account 
AA ;)




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