Complete.Org: Mailing Lists: Archives: freeciv-ai: November 2003:
[freeciv-ai] Re: (PR#6807) [Bug] fstk suggests to attack non-enemy
Home

[freeciv-ai] Re: (PR#6807) [Bug] fstk suggests to attack non-enemy

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [freeciv-ai] Re: (PR#6807) [Bug] fstk suggests to attack non-enemy
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sun, 9 Nov 2003 15:40:39 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=6807 >

On Sun, 9 Nov 2003, Gregory Berkolaiko wrote:
> The following is a part of the problem.
> From Paulz profile I can see that each execution of ai_military_attack
> calls fstk around 5 times on average.This is because fstk suggests a
> victim which is not our enemy now, we are next to it, but we cannot
> attack it, so we call fstk again.
>
> There is a reason why fstk suggests a non-enemy, it's because this
> non-enemy is our "war target" or "enemy-to-be". Because fstk is also
> used to evaluate building wants, it views the "enemy-to-be" as an enemy
> so we can build units against them before we actually declare war on them.
>
> When it comes to finding stk for a real unit, this behaviour is not so
> desirable though.

Since fstk is going the way of the dodo anyway, I think maybe we should
just revert the AI diplomatic clerverness I put in there to make it build
up against 'war targets'.

Diff:
-    if (!HOSTILE_PLAYER(pplayer, ai, aplayer)) {
+    if (!pplayers_at_war(pplayer, aplayer)) {

Or we could fix it, using the fact that punit->id will be zero if we pass
a virtual unit to fstk.

Diff:
-    if (!HOSTILE_PLAYER(pplayer, ai, aplayer)) {
+    if ((punit->id == 0 && !HOSTILE_PLAYER(pplayer, ai, aplayer))
+         || (punit->id != 0 && !pplayers_at_war(pplayer, aplayer))) {

Up to you, Greg.

  - Per




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