[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]
On Mon, 23 Dec 2002, Gregory Berkolaiko via RT wrote:
> I think we might should let it be. Maybe add another check, but that's
> it. AI was functioning before, so it's ok...
Yes, please just add the extra check...
> For CVS, I started making your changes and got carried away.Attached is
> the result.It makes sure ai_unit_attack returns a bool value,
> ai_unit_rampage also returns a bool rather than nobody knows why punit.
> Also reodered things for uniformity.
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?
- Per
- [freeciv-ai] Re: (PR#2634) ai_military_attack() bug#2,
Per I. Mathisen via RT <=
|
|