0
0
mirror of https://github.com/Nimac0/SDL_Minigame synced 2026-01-12 07:53:43 +00:00

fixed error detection in map

This commit is contained in:
Benedikt Galbavy 2024-01-30 16:13:48 +01:00
parent 325da0eb4c
commit 3b18b05e78

View File

@ -30,6 +30,7 @@ bool Map::loadMap(const char* path, int sizeX, int sizeY)
continue;
Game::addTile(std::stoi(tileIDstr), x * TILE_SIZE, y * TILE_SIZE);
tileIDstr.clear();
x++;
if (singleChar == '\n') {
if (x != sizeX) {
SDL_SetError("Error loading map: specified x size doesn't match map file!");
@ -39,7 +40,6 @@ bool Map::loadMap(const char* path, int sizeX, int sizeY)
y++;
continue;
}
x++;
continue;
}
if (!std::isdigit(singleChar)) continue;