[Top][All Lists]

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

Re: [glob2-devel] Bug in Map.cpp Checksum computation

From: Nuage
Subject: Re: [glob2-devel] Bug in Map.cpp Checksum computation
Date: Tue, 25 Jan 2005 18:42:44 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20050122

Thank you! Yes, this is an error, all checkSum() methods has to use
Uint32! There where identical mistakes in:
It is fixed in cvs.

simon schuler wrote:
The checksum computation here is almost useless: It returned the same value for over a minute, until i quit the game...

   Sint32 Map::checkSum(bool heavy)
       Sint32 cs=size;
       if (heavy)
           for (int y=0; y<h; y++)
               for (int x=0; x<w; x++)
       return cs;

The rotate Statement cs=(cs<<1)|(cs>>31); is wrong for signed integers and will overwrite the whole integer with 0xFFFFFFFF when cs is negative. Game.cpp expects an Uint32 as return type anyway, so we just have to change the type of cs to Uint32, and make Map::checkSum return an Uint32. After changing this, it returned usable values...


glob2-devel mailing list

reply via email to

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