treballant en sistema de portes i claus
This commit is contained in:
34
source/game/gameplay/inventory.hpp
Normal file
34
source/game/gameplay/inventory.hpp
Normal 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
|
||||
};
|
||||
Reference in New Issue
Block a user