aboutsummaryrefslogtreecommitdiff
path: root/src/crepe
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-12-07 14:19:26 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-12-07 14:19:26 +0100
commitf3009ab8f0785a54d3fd83c0d758c8ebd901adda (patch)
tree6e9df9ef2311c28ee590c30e3a1f00018105bdd9 /src/crepe
parent90c6bf03e59fdec64f850310bcbff45ae86f69e3 (diff)
`make format`
Diffstat (limited to 'src/crepe')
-rw-r--r--src/crepe/manager/ComponentManager.cpp11
-rw-r--r--src/crepe/manager/ComponentManager.h5
-rw-r--r--src/crepe/manager/ComponentManager.hpp11
3 files changed, 14 insertions, 13 deletions
diff --git a/src/crepe/manager/ComponentManager.cpp b/src/crepe/manager/ComponentManager.cpp
index 44774d9..df30d27 100644
--- a/src/crepe/manager/ComponentManager.cpp
+++ b/src/crepe/manager/ComponentManager.cpp
@@ -64,14 +64,11 @@ void ComponentManager::set_persistent(game_object_id_t id, bool 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;
- });
+ 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;
- });
+ return this->get_objects_by_predicate<Metadata>(
+ [tag](const Metadata & data) { return data.tag == tag; });
}
-
diff --git a/src/crepe/manager/ComponentManager.h b/src/crepe/manager/ComponentManager.h
index 4e53954..685cae5 100644
--- a/src/crepe/manager/ComponentManager.h
+++ b/src/crepe/manager/ComponentManager.h
@@ -1,10 +1,10 @@
#pragma once
#include <memory>
+#include <set>
#include <typeindex>
#include <unordered_map>
#include <vector>
-#include <set>
#include "../Component.h"
#include "../types.h"
@@ -156,7 +156,8 @@ public:
private:
template <typename T>
- std::set<game_object_id_t> get_objects_by_predicate(const std::function<bool (const T &)> & pred) const;
+ std::set<game_object_id_t>
+ get_objects_by_predicate(const std::function<bool(const T &)> & pred) const;
template <typename T>
RefVector<T> get_components_by_ids(const std::set<game_object_id_t> & ids) const;
diff --git a/src/crepe/manager/ComponentManager.hpp b/src/crepe/manager/ComponentManager.hpp
index 52df368..9e70865 100644
--- a/src/crepe/manager/ComponentManager.hpp
+++ b/src/crepe/manager/ComponentManager.hpp
@@ -101,7 +101,8 @@ RefVector<T> ComponentManager::get_components_by_id(game_object_id_t id) const {
type_index type = typeid(T);
if (!this->components.contains(type)) return {};
- const by_id_index<vector<unique_ptr<Component>>> & components_by_id = this->components.at(type);
+ const by_id_index<vector<unique_ptr<Component>>> & components_by_id
+ = this->components.at(type);
if (id >= components_by_id.size()) return {};
RefVector<T> out = {};
@@ -151,7 +152,8 @@ RefVector<T> ComponentManager::get_components_by_type() const {
}
template <typename T>
-std::set<game_object_id_t> ComponentManager::get_objects_by_predicate(const std::function<bool (const T &)> & pred) const {
+std::set<game_object_id_t>
+ComponentManager::get_objects_by_predicate(const std::function<bool(const T &)> & pred) const {
using namespace std;
set<game_object_id_t> objects = {};
@@ -168,9 +170,10 @@ std::set<game_object_id_t> ComponentManager::get_objects_by_predicate(const std:
}
template <typename T>
-RefVector<T> ComponentManager::get_components_by_ids(const std::set<game_object_id_t> & ids) const {
+RefVector<T>
+ComponentManager::get_components_by_ids(const std::set<game_object_id_t> & ids) const {
using namespace std;
-
+
RefVector<T> out = {};
for (game_object_id_t id : ids) {
RefVector<T> components = get_components_by_id<T>(id);