Resuelto un bug cuando el jugador salta fuera de la pantalla por arriba y no hay cambio de habitación

This commit is contained in:
2022-11-08 16:47:15 +01:00
parent 0404b184e7
commit 9de1b8ad6e

View File

@@ -734,9 +734,10 @@ tile_e Room::getTile(SDL_Point point)
// Devuelve el tipo de tile que hay en ese indice // Devuelve el tipo de tile que hay en ese indice
tile_e Room::getTile(int index) tile_e Room::getTile(int index)
{ {
const int maxTile = mapWidth * mapHeight; //const bool onRange = (index > -1) && (index < mapWidth * mapHeight);
const bool onRange = (index > -1) && (index < (int)tileMap.size());
if (index < maxTile) if (onRange)
{ {
// Las filas 0-8 son de tiles t_wall // Las filas 0-8 son de tiles t_wall
if ((tileMap.at(index) >= 0) && (tileMap.at(index) < 9 * tileSetWidth)) if ((tileMap.at(index) >= 0) && (tileMap.at(index) < 9 * tileSetWidth))