A really shitty ritual crafting UI is working but needs a big reshape.

This commit is contained in:
Zed A. Shaw 2025-04-29 23:59:40 -04:00
parent 14619558fa
commit 2ceab51c40
13 changed files with 124 additions and 63 deletions

View file

@ -154,20 +154,38 @@ namespace ritual {
}
DinkyECS::Entity Blanket::add(JunkItem name) {
auto ent = contents.entity();
contents.set(ent, name);
return ent;
DinkyECS::Entity id = ++entity_counter;
contents.insert_or_assign(id, name);
return id;
}
std::string& Blanket::get(DinkyECS::Entity ent) {
return contents.get<JunkItem>(ent);
return contents.at(ent);
}
bool Blanket::has(DinkyECS::Entity ent) {
return contents.has<JunkItem>(ent);
return contents.contains(ent);
}
void Blanket::remove(DinkyECS::Entity ent) {
contents.remove<JunkItem>(ent);
contents.erase(ent);
}
void Blanket::select(DinkyECS::Entity ent) {
selected.insert_or_assign(ent, true);
}
void Blanket::deselect(DinkyECS::Entity ent) {
selected.erase(ent);
}
bool Blanket::is_selected(DinkyECS::Entity ent) {
return selected.contains(ent) && selected.at(ent);
}
void Blanket::reset() {
selected.clear();
}
}