35 lines
1.2 KiB
C++
35 lines
1.2 KiB
C++
#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
|
|
};
|