When I run my program I get:
"Unhandled exception at 0x7c901230 in SDL.exe: User breakpoint."
I dont really know what the error means but I commented out all the functions called in my main loop and brought them back one by one. So I know its this functions in which the error occurs:
void Game::MakeWorld() {
sdl.writeLog("Making world"); // write in the log file
bool LastWasOne = false;
// loop through the entire tilesystem,
// inner loop is for each line on the x axis, and is runned once for every line
for(int y = 0; y < sizeX; y++) {
for(int x = 0; x < sizeY; x++) {
if(LastWasOne == true){
SetTileData(x, y, '0');
LastWasOne = false;
}
else {
SetTileData(x, y, '1');
LastWasOne = true;
}
}
}
}
SizeX and Y is how many tiles I got on each axis, they are defined like this:
#define RESX 640
#define RESY 480
#define GRIDSIZE 16
// let the class know how many tiles we got on each axis
sizeX = RESX / GRIDSIZE;
sizeY = RESY / GRIDSIZE;
The SetTileData function writes to a vector which holds a char for every tile on the gamefield;
// calculate how many tiles there is on the x axis multiply with y then add the remaining to find out where on that row
void SetTileData(int x, int y, char data) {tile[ ((RESX/GRIDSIZE) * y) + x ] = data;}
And heres the vector:
std::vector <char> tile; // holds the data for all the tiles
The vector is resized in the constructor.
Anyone knows what could be wrong?