aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/manager/ComponentManager.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-12-10 19:24:46 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-12-10 19:24:46 +0100
commit4414fe5079b44d5bbcbba89bb1e71ce01b949226 (patch)
treebba8287de88f5eeca992f000ee425c067d616ce0 /src/crepe/manager/ComponentManager.cpp
parent1e5c6c5cf0d1be976e0e59099ddcfc62940ef1be (diff)
parent0cb7f2f82ca167656b3c5cb9f0cc3b44c59cb0eb (diff)
merge master
Diffstat (limited to 'src/crepe/manager/ComponentManager.cpp')
-rw-r--r--src/crepe/manager/ComponentManager.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/crepe/manager/ComponentManager.cpp b/src/crepe/manager/ComponentManager.cpp
index 80cf8b4..df30d27 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,13 @@ 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; });
+}