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]
To: guillaume.melquiond@xxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#14904) Bugs in AI diplomacy code
From: "Peter Schaefer" <peter.schaefer@xxxxxxxxx>
Date: Wed, 21 Dec 2005 12:36:23 -0800
Reply-to: bugs@xxxxxxxxxxx

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

Does "adip->countdown < -1" ever happen?

Just curious, sounds weird to me ;-)

On 12/20/05, Guillaume Melquiond <guillaume.melquiond@xxxxxxxxx> wrote:
>
> <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]