aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/manager/ComponentManager.cpp
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-11 16:28:37 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-11 16:28:37 +0100
commita108f7360e03cc7826ad4ed0cee464b1196fa456 (patch)
tree2de89843620b8ec65b99a56bd3c2428bef733852 /src/crepe/manager/ComponentManager.cpp
parentd80c98ee03e59e0c38e025a7fe83ab4c39115fb8 (diff)
parent78c4a8772526f40c531b5402b56932b0a41e22e8 (diff)
Merge branch 'master' of https://github.com/lonkaars/crepe into wouter/text-component
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; });
+}