diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-06 17:13:59 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-06 17:13:59 +0100 |
commit | f4824f5e7e6cee12bec602f3240770945a73d043 (patch) | |
tree | 7d51652e5395ca70f995c0d059c36e1dd18bd8ae /src/crepe/manager/ComponentManager.cpp | |
parent | 0bed469e2ececfa240085a34252dd7ed23519de3 (diff) |
add more fetching functions to ComponentManager
Diffstat (limited to 'src/crepe/manager/ComponentManager.cpp')
-rw-r--r-- | src/crepe/manager/ComponentManager.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/crepe/manager/ComponentManager.cpp b/src/crepe/manager/ComponentManager.cpp index 80cf8b4..44774d9 100644 --- a/src/crepe/manager/ComponentManager.cpp +++ b/src/crepe/manager/ComponentManager.cpp @@ -1,4 +1,5 @@ #include "../api/GameObject.h" +#include "../api/Metadata.h" #include "../types.h" #include "../util/Log.h" @@ -61,3 +62,16 @@ GameObject ComponentManager::new_object(const string & name, const string & tag, void ComponentManager::set_persistent(game_object_id_t id, bool persistent) { this->persistent[id] = persistent; } + +set<game_object_id_t> ComponentManager::get_objects_by_name(const string & name) const { + return this->get_objects_by_predicate<Metadata>([name](const Metadata & data) { + return data.name == name; + }); +} + +set<game_object_id_t> ComponentManager::get_objects_by_tag(const string & tag) const { + return this->get_objects_by_predicate<Metadata>([tag](const Metadata & data) { + return data.tag == tag; + }); +} + |