fix: corregida logica per obrir i entrar a la jail. ja no mira el nom de la habitacio sino el numero

This commit is contained in:
2026-03-29 12:58:32 +02:00
parent f5a82229fe
commit 1bb2142d19
9 changed files with 73 additions and 41 deletions

View File

@@ -5,6 +5,7 @@
#include "core/rendering/screen.hpp" // Para Screen
#include "core/rendering/surface.hpp" // Para Surface
#include "core/resources/resource_cache.hpp" // Para Resource
#include "game/defaults.hpp" // Para Defaults::Game
#include "game/gameplay/collision_map.hpp" // Para CollisionMap
#include "game/gameplay/enemy_manager.hpp" // Para EnemyManager
#include "game/gameplay/item_manager.hpp" // Para ItemManager
@@ -82,7 +83,7 @@ void Room::initializeRoom(const Data& room) {
// Abre la jail para poder entrar
void Room::openTheJail() { // NOLINT(readability-convert-member-functions-to-static)
if (data_->jail_is_open && name_ == "THE JAIL") {
if (data_->jail_is_open && number_ == Defaults::Game::Room::END_ROOM) {
// Elimina el último enemigo (Bry debe ser el último enemigo definido en el fichero)
if (!enemy_manager_->isEmpty()) {
enemy_manager_->removeLastEnemy();

View File

@@ -61,6 +61,7 @@ class Room {
~Room(); // NOLINT(modernize-use-equals-default, performance-trivially-destructible) -- defined in .cpp for unique_ptr with forward declarations
// --- Funciones ---
[[nodiscard]] auto getNumber() const -> const std::string& { return number_; } // Devuelve el numero de la habitación
[[nodiscard]] auto getName() const -> const std::string& { return name_; } // Devuelve el nombre de la habitación
[[nodiscard]] auto getBGColor() const -> Uint8 { return stringToColor(bg_color_); } // Devuelve el color de la habitación
[[nodiscard]] auto getBorderColor() const -> Uint8 { return stringToColor(border_color_); } // Devuelve el color del borde