Fix bmap reading error caused by signed/unsigned comparison

This commit is contained in:
Simon Robertshaw 2012-06-05 22:55:39 +01:00
parent 49dafbfd26
commit 7063587706
2 changed files with 4 additions and 5 deletions

View File

@ -47,8 +47,8 @@ void GameSave::setSize(int newWidth, int newHeight)
this->height = (newHeight/CELL)*CELL;
particles = new Particle[NPART];
blockMap = new char*[height/CELL];
blockMapPtr = new char[(height/CELL)*(width/CELL)];
blockMap = new unsigned char*[height/CELL];
blockMapPtr = new unsigned char[(height/CELL)*(width/CELL)];
fill(blockMapPtr, blockMapPtr+((height/CELL)*(width/CELL)), 0);
for(int y = 0; y < height/CELL; y++)
blockMap[y] = &blockMapPtr[y*(width/CELL)];
@ -658,7 +658,6 @@ GameSave::ParseResult GameSave::readPSv(char * data, int dataLength)
p++;
continue;
}
blockMap[y][x] = d[p];
if (blockMap[y][x]==1)
blockMap[y][x]=WL_WALL;

View File

@ -23,7 +23,7 @@ public:
//int ** particleMap;
int particlesCount;
Particle * particles;
char ** blockMap;
unsigned char ** blockMap;
float ** fanVelX;
float ** fanVelY;
@ -63,7 +63,7 @@ public:
private:
float * fanVelXPtr;
float * fanVelYPtr;
char * blockMapPtr;
unsigned char * blockMapPtr;
ParseResult readOPS(char * data, int dataLength);
ParseResult readPSv(char * data, int dataLength);