Arreglado el color del marcador

This commit is contained in:
2022-11-02 00:17:25 +01:00
parent b4df851bd3
commit 12255750f6

View File

@@ -297,31 +297,37 @@ void Game::renderRoomName()
bool Game::changeRoom(std::string file) bool Game::changeRoom(std::string file)
{ {
// En las habitaciones los limites tienen la cadena del fichero o un 0 en caso de no limitar con nada // En las habitaciones los limites tienen la cadena del fichero o un 0 en caso de no limitar con nada
if (file != "0") if (file == "0")
// Verifica que exista el fichero que se va a cargar {
if (asset->get(file) != "") return false;
{ }
// Elimina la habitación actual
delete room;
room = nullptr;
// Crea un objeto habitación nuevo a partir del fichero // Verifica que exista el fichero que se va a cargar
room = new Room(resource->getRoom(file), renderer, screen, asset, options, itemTracker, &board.items, debug); if (asset->get(file) != "")
{
// Elimina la habitación actual
delete room;
room = nullptr;
// Actualiza el marcador // Crea un objeto habitación nuevo a partir del fichero
const color_t c = room->getBorderColor(); // Pone el color del marcador room = new Room(resource->getRoom(file), renderer, screen, asset, options, itemTracker, &board.items, debug);
board.color = (c.r + c.g + c.b == 0) ? stringToColor(options->palette, "white") : c; // Si el color es negro lo cambia a blanco
if (roomTracker->addRoom(file))
{ // Incrementa el contador de habitaciones visitadas
board.rooms++;
}
// Pasa la nueva habitación al jugador // Actualiza el marcador
player->setRoom(room); const color_t c = room->getBorderColor(); // Obtiene el color del vorde
const color_t cBlack = stringToColor(options->palette, "black");
return true; board.color = (c.r == cBlack.r && c.g == cBlack.g && c.b == cBlack.b) ? stringToColor(options->palette, "white") : c; // Si el color es negro lo cambia a blanco
// board.color = (c.r + c.g + c.b == 0) ? stringToColor(options->palette, "white") : c; // Si el color es negro lo cambia a blanco
if (roomTracker->addRoom(file))
{ // Incrementa el contador de habitaciones visitadas
board.rooms++;
} }
// Pasa la nueva habitación al jugador
player->setRoom(room);
return true;
}
return false; return false;
} }