Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2005:
[Freeciv-Dev] Re: (PR#14904) Bugs in AI diplomacy code
Home

[Freeciv-Dev] Re: (PR#14904) Bugs in AI diplomacy code

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#14904) Bugs in AI diplomacy code
From: "Guillaume Melquiond" <guillaume.melquiond@xxxxxxxxx>
Date: Tue, 20 Dec 2005 13:47:57 -0800
Reply-to: bugs@xxxxxxxxxxx

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

2005/12/20, Per I. Mathisen:
> Hello,
>
> Thanks for looking at the AI code.
>
> On Mon, 19 Dec 2005, Guillaume Melquiond wrote:
> > At ai/advdiplomacy.c:307, there is some obviously non-sensical code:
> >     else if (adip->countdown >= 0 && adip->countdown < -1)
> > I suppose the intent was to testfor (adip->countdown != -1) instead (as is
> > done at line 318), so that the AI player refuses a peace treaty when there
> > is a countdown going on.
>
> No, merely adip->countdown != -1 is not correct. The line in 308 which
> reads || instead of && is correct (it does not say != -1 though).

You are really confusing me here. Since countdown is an integer, how
can "(adip->countdown >= 0 || adip->countdown < -1)" be any different
from "(adip->countdown != -1)"? I don't get the subtlety of the
condition used in the diplomacy advisor.

> Patch attached with some fixes and added comments. Not tested.

It won't do, you have lost a "< 0" at the end. The AI would refuse a
ceasefire if it was strictly advantageous. Seems fine to me otherwise
(not tested though, but my patch was, so it should be fine).

Best regards,

Guillaume





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