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

@@ -94,12 +94,12 @@ void Debug::setDebugFile(const std::string& path) {
// Convierte string a SceneManager::Scene (para debug.yaml)
static auto sceneFromString(const std::string& s) -> SceneManager::Scene {
if (s == "LOGO") { return SceneManager::Scene::LOGO; }
if (s == "LOGO") { return SceneManager::Scene::LOGO; }
if (s == "LOADING") { return SceneManager::Scene::LOADING_SCREEN; }
if (s == "TITLE") { return SceneManager::Scene::TITLE; }
if (s == "TITLE") { return SceneManager::Scene::TITLE; }
if (s == "CREDITS") { return SceneManager::Scene::CREDITS; }
if (s == "DEMO") { return SceneManager::Scene::DEMO; }
if (s == "ENDING") { return SceneManager::Scene::ENDING; }
if (s == "DEMO") { return SceneManager::Scene::DEMO; }
if (s == "ENDING") { return SceneManager::Scene::ENDING; }
if (s == "ENDING2") { return SceneManager::Scene::ENDING2; }
return SceneManager::Scene::GAME; // Fallback seguro
}
@@ -107,14 +107,22 @@ static auto sceneFromString(const std::string& s) -> SceneManager::Scene {
// Convierte SceneManager::Scene a string (para debug.yaml)
static auto sceneToString(SceneManager::Scene scene) -> std::string {
switch (scene) {
case SceneManager::Scene::LOGO: return "LOGO";
case SceneManager::Scene::LOADING_SCREEN: return "LOADING";
case SceneManager::Scene::TITLE: return "TITLE";
case SceneManager::Scene::CREDITS: return "CREDITS";
case SceneManager::Scene::DEMO: return "DEMO";
case SceneManager::Scene::ENDING: return "ENDING";
case SceneManager::Scene::ENDING2: return "ENDING2";
default: return "GAME";
case SceneManager::Scene::LOGO:
return "LOGO";
case SceneManager::Scene::LOADING_SCREEN:
return "LOADING";
case SceneManager::Scene::TITLE:
return "TITLE";
case SceneManager::Scene::CREDITS:
return "CREDITS";
case SceneManager::Scene::DEMO:
return "DEMO";
case SceneManager::Scene::ENDING:
return "ENDING";
case SceneManager::Scene::ENDING2:
return "ENDING2";
default:
return "GAME";
}
}

View File

@@ -43,10 +43,10 @@ class Debug {
void setDebugFile(const std::string& path); // Establece la ruta del archivo debug.yaml
void loadFromFile(); // Carga la configuración de debug desde debug.yaml
void saveToFile() const; // Guarda la configuración de debug en debug.yaml
[[nodiscard]] auto getSpawnSettings() const -> const SpawnSettings& { return spawn_settings_; } // Obtiene los valores de spawn
void setSpawnSettings(const SpawnSettings& s) { spawn_settings_ = s; } // Establece los valores de spawn
[[nodiscard]] auto getInitialScene() const -> SceneManager::Scene { return initial_scene_; } // Obtiene la escena inicial de debug
void setInitialScene(SceneManager::Scene s) { initial_scene_ = s; } // Establece la escena inicial de debug
[[nodiscard]] auto getSpawnSettings() const -> const SpawnSettings& { return spawn_settings_; } // Obtiene los valores de spawn
void setSpawnSettings(const SpawnSettings& s) { spawn_settings_ = s; } // Establece los valores de spawn
[[nodiscard]] auto getInitialScene() const -> SceneManager::Scene { return initial_scene_; } // Obtiene la escena inicial de debug
void setInitialScene(SceneManager::Scene s) { initial_scene_ = s; } // Establece la escena inicial de debug
private:
static Debug* debug; // [SINGLETON] Objeto privado
@@ -55,14 +55,14 @@ class Debug {
~Debug() = default; // Destructor
// Variables
std::map<std::string, std::string> watches_; // Watch window: valores persistentes (key→value)
std::vector<std::string> slot_; // One-shot: textos que se limpian cada frame
std::vector<std::string> log_; // Log persistente
int x_ = 0; // Posicion donde escribir el texto de debug
int y_ = 0; // Posición donde escribir el texto de debug
bool enabled_ = false; // Indica si esta activo el modo debug
std::string debug_file_path_; // Ruta del archivo debug.yaml
SpawnSettings spawn_settings_; // Configuración de spawn para debug
std::map<std::string, std::string> watches_; // Watch window: valores persistentes (key→value)
std::vector<std::string> slot_; // One-shot: textos que se limpian cada frame
std::vector<std::string> log_; // Log persistente
int x_ = 0; // Posicion donde escribir el texto de debug
int y_ = 0; // Posición donde escribir el texto de debug
bool enabled_ = false; // Indica si esta activo el modo debug
std::string debug_file_path_; // Ruta del archivo debug.yaml
SpawnSettings spawn_settings_; // Configuración de spawn para debug
SceneManager::Scene initial_scene_ = SceneManager::Scene::GAME; // Escena inicial en debug
};