glob2-devel
[Top][All Lists]
Advanced

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

Re: [glob2-devel] Re: what was the cause of repair bug?


From: Kai Antweiler
Subject: Re: [glob2-devel] Re: what was the cause of repair bug?
Date: Tue, 17 Apr 2007 09:16:52 +0200
User-agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.20 (linux)

> Level 1 building construction site: 0
> Level 1 building completed: 1
> Level 2 building construction site: 2
> Level 2 building completed: 3
> Level 3 building construction site: 4
> Level 3 building completed: 5
>
> When a completeted level 1 building goes into construction, its
> "technical level" goes from 1 to 0. If we take prev level when its at
> 0, this is -1, which means invalid.

The difference between construction site and building seems to be
just the first bit.  Swapping that seems to be safer.
"level ^=1;"
^ is binary xor, right?


Better would be using different functions:
newBuildingLevel:
 assert (level <=4);
 level &= 0xfe;
 level+=2;
convertToConstructionSite:
 level |= 1;
convertToBuilding:
 level &=0xfe;

We could use 0xe or 0x7 instead of 0x7e, but that is not the point.

-- 
Kai Antweiler




reply via email to

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