treballant en sistema de portes i claus

This commit is contained in:
2026-04-10 09:47:48 +02:00
parent 9aff4432df
commit 97c30bf9a1
37 changed files with 1236 additions and 110 deletions

View File

@@ -0,0 +1,34 @@
#pragma once
#include <set> // Para set
#include <string> // Para string
/**
* @brief Inventario global del jugador (singleton)
*
* Mantiene el conjunto de identificadores de llaves recogidas durante la partida.
* Persiste entre habitaciones y entre muertes (igual que ItemTracker).
*/
class Inventory {
public:
// Gestión singleton
static void init(); // Inicialización
static void destroy(); // Destrucción
static auto get() -> Inventory*; // Acceso al singleton
// Gestión de llaves
void addKey(const std::string& key_id); // Añade una llave al inventario
[[nodiscard]] auto hasKey(const std::string& key_id) const -> bool; // Comprueba si tiene una llave
void clear(); // Vacía el inventario (reset de partida)
private:
// Constantes singleton
static Inventory* inventory; // [SINGLETON] Objeto privado
// Constructor y destructor privados [SINGLETON]
Inventory() = default;
~Inventory() = default;
// Variables miembro
std::set<std::string> keys_; // Conjunto de identificadores de llaves recogidas
};