Big BIG refactor to make inventory use a model that's placed into the world, following a more sane MVC style.
This commit is contained in:
parent
119b3ed11d
commit
a0eff927b6
21 changed files with 270 additions and 123 deletions
21
inventory.hpp
Normal file
21
inventory.hpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#include "dinkyecs.hpp"
|
||||
#include <unordered_map>
|
||||
|
||||
namespace inventory {
|
||||
using Slot = std::string;
|
||||
|
||||
struct Model {
|
||||
std::unordered_map<Slot, DinkyECS::Entity> by_slot;
|
||||
std::unordered_map<DinkyECS::Entity, Slot> by_entity;
|
||||
|
||||
void add(const Slot &in_slot, DinkyECS::Entity ent);
|
||||
Slot& get(DinkyECS::Entity ent);
|
||||
DinkyECS::Entity get(const Slot& slot);
|
||||
bool has(DinkyECS::Entity ent);
|
||||
bool has(const Slot& slot);
|
||||
void remove(const Slot& slot, DinkyECS::Entity ent);
|
||||
void remove(DinkyECS::Entity ent);
|
||||
void remove(const Slot& slot);
|
||||
void invariant();
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue