Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: Core is_tiles_adjacent
Home

[Freeciv-Dev] Re: Core is_tiles_adjacent

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rf13@xxxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx, Paul Zastoupil <paulz@xxxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: Core is_tiles_adjacent
From: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Date: Sat, 6 Oct 2001 01:57:31 +0100 (BST)

 --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote: 
> On Fri, Oct 05, 2001 at 04:54:55PM +0100, Gregory Berkolaiko wrote:
> >  --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote: 
> > > On Thu, Oct 04, 2001 at 03:36:46PM -0700, Paul Zastoupil wrote:
> > > > > Assertion failed: is_tiles_adjacent(punit->x, punit->y, x, y),
> file
> > > > unittools.c, line 3097
[..]
> > 
> > The assert does not belong in there.  I removed
> >   if ( is_tiles_adjacent(punit->x, punit->y, x, y) )
> > not because they are always adjacent, but because there is this same
> > check in handle_unit_move_request which follows in 2 lines and it
> gives a
> > proper debug message and returns a proper fail value (actually not
> > proper, it returns 0) and it is caught and digested later in the
> code.
> > 
> > And I did explain it in my submission email.
> 
> Shame on me.

Actually praise on you.  The assert should not have been there, but even
if it was it should not fail all that often.  But it did, I became
suspicious and had a look at the code.

And discovered a most annoying bug!!

The goto in interactive mode just didn't work.  I didn't catch it before
because I only tested the autogames and ai doesn't use goto proper.

Anyway, the attached patch should fix both assert and the buggy
behaviour.
The problem was that function would return earlier than all the
neccessary updates were done.

Sorry, mea culpa...

G.

P.S.  Seemingly random distribution of checks through the procedure is
done to comply with the ordering detailed in 
  http://www.freeciv.org/lxr/source/server/gotohand.h?v=cvs#L19

____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie

Attachment: oops.diff
Description: oops.diff


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