[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]
<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
>
>
>
>
>
|
|