Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2005:
[Freeciv-Dev] Re: (PR#12788) Does a Unit Ever Know its Body Guard?
Home

[Freeciv-Dev] Re: (PR#12788) Does a Unit Ever Know its Body Guard?

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#12788) Does a Unit Ever Know its Body Guard?
From: "Benedict Adamson" <badamson@xxxxxxxxxxx>
Date: Wed, 13 Apr 2005 16:14:02 -0700
Reply-to: bugs@xxxxxxxxxxx

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

Per I. Mathisen wrote:
...
> this might be a source of some errors in the AI.

The functions ai_unit_move and ai_unit_attack uses ai.bodyguard to try 
to bring a guard along with a unit. Part of aiferry_gobyboat tries to 
load the bodyguard of a passenger onto the same boat using ai.bodyguard.

It seems to me that bodyguards will never move with their charge as the 
code is now.

> Can you make a patch?

Yes. See my work on an AI guard API (PR#12781), which is how I found 
this problem.
    <URL: http://bugs.freeciv.org/Ticket/Display.html?id=12781 >
That API manipulates ai.bodyguard and ai.charge values to keep them 
consistent.

At present any number of units can think they are the guard for a unit: 
several untis could have the same value for ai.charge. Keeping 
ai.bodyguard and ai.charge consistent would prevent that. I suspect that 
is the intent of the current code anyway: ai.bodyguard is not a list, 
and bodyguards are intended to stack with a unit, which is best if there 
is only one guard.

If a unit could have at most one guard, there would have to be someway 
for a unit to detect that its assigned guard is no good (too far away, 
too weak) and request another. Perhaps by releasing and re-requesting 
guards every turn.





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