glob2-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [glob2-devel] Intended behaviour for locking and isInLocalGradient()


From: Joe Wells
Subject: Re: [glob2-devel] Intended behaviour for locking and isInLocalGradient()?
Date: Sat, 08 Sep 2007 03:04:35 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Erik Søe Sørensen <address@hidden> writes:

> I applied valgrind to glob2, to locate the source of some
> double-free errors.

Yay!!!  Hurray!!!

> Before I got that far, however, I found a bug leading to
> nondeterminism:

And non-determinism can lead to net games being aborted, so this is
an important consideration.

> Map::buildingAvailable() reads the building's localGradient if it is
> not dirty.
> But updateLocalGradient does not ensure that not-dirty means updated -
> at least not with the optimized version. If ULG determines that the
> building should be locked, then the gradient is not updated.
> I'll fix this by updating with a non-propagated gradient; I think this
> was the original behaviour, but I don't know if it is the right thing
> to do.
> (A related bugfix is to not be lazy in ULG when the gradient is dirty.)
>
> Sanity-check on my assumptions: A building is locked if it is not
> reachable, have I understood this correctly? What are/should be the
> exact conditions?
> It looks like currently it is deemed locked if it is not 'easily'
> accessible from (-1,-1) relative to it... I can't say I grok it.

I don't really know this part of the code.  I think there are two
versions of “locked”: one for not-reachable by non-swimmers and one
for not-reachable by swimmers.  I think this information is used by
some of the AIs.

Sorry I don't know anything about the rest of your questions.

-- 
Joe

> And one more question about the intentions of the code (the comments
> are not plenty, the considering the complexity):
> Map::isInLocalGradient() - I suppose this should tell whether the
> local gradient map for a building can be used for a given unit
> coordinate. This area is a 32x32 square around the building, right?
> Apparently not, judging from the function; for instance, it disallows
> in some cases the point +(15,15) from the building.
>
> I'd have expected something like...
> bool Map::isInLocalGradient(int ux, int uy, int bx, int by) {
>    int dx = (ux-bx+15)&wMask;
>    int dy = (uy-by+15)&hMask;
>    return (dx<32 && dy<32);
> }
>
> /Erik [seeking enlightenment :-]




reply via email to

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