A retro style homage to 80s dungeon crawlers hand crafted in C++.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
raycaster/inventory.hpp

24 lines
906 B

#include "dinkyecs.hpp"
#include <unordered_map>
// BUG: this should have a bool for "permanent" or "constant" so that
// everything working with it knows to do the make_constant/not_constant
// dance when using it. Idea is the System:: ops for this would get it
// and then look at the bool and add the constant ops as needed.
namespace inventory {
struct Model {
std::unordered_map<std::string, DinkyECS::Entity> by_slot;
std::unordered_map<DinkyECS::Entity, std::string> by_entity;
bool add(const std::string &in_slot, DinkyECS::Entity ent);
const std::string& get(DinkyECS::Entity ent);
DinkyECS::Entity get(const std::string& slot);
bool has(DinkyECS::Entity ent);
bool has(const std::string& slot);
void remove(DinkyECS::Entity ent);
void invariant();
void dump();
void swap(DinkyECS::Entity a_ent, DinkyECS::Entity b_ent);
size_t count();
};
}