You can now go down stairs to new levels, but when you do you become stairs or a random monster.
This commit is contained in:
parent
c14efee9ea
commit
2825faf038
7 changed files with 100 additions and 49 deletions
|
@ -58,13 +58,20 @@ namespace DinkyECS {
|
|||
template <typename Comp>
|
||||
Comp &get_the() {
|
||||
auto comp_id = std::type_index(typeid(Comp));
|
||||
dbc::check($facts.contains(comp_id), "!!!! ATTEMPT to access world fact that hasn't been set yet.");
|
||||
dbc::check($facts.contains(comp_id),
|
||||
fmt::format("!!!! ATTEMPT to access world fact that hasn't been set yet: {}", typeid(Comp).name()));
|
||||
|
||||
// use .at to get std::out_of_range if fact not set
|
||||
std::any &res = $facts.at(comp_id);
|
||||
return std::any_cast<Comp&>(res);
|
||||
}
|
||||
|
||||
template <typename Comp>
|
||||
bool has_the() {
|
||||
auto comp_id = std::type_index(typeid(Comp));
|
||||
return $facts.contains(comp_id);
|
||||
}
|
||||
|
||||
template <typename Comp>
|
||||
void set(Entity ent, Comp val) {
|
||||
EntityMap &map = entity_map_for<Comp>();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue