aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/manager/ComponentManager.hpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-12-22 12:32:22 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-12-22 12:32:22 +0100
commit61148c757a1f742ff09e40e5347e74e638c7371c (patch)
treea2e40998981fa6f12430d2a1254250219f30d44f /src/crepe/manager/ComponentManager.hpp
parente2162171c7ab72f450f73a0908946aa4a4dee5ee (diff)
update clang-format optionsHEADmaster
Diffstat (limited to 'src/crepe/manager/ComponentManager.hpp')
-rw-r--r--src/crepe/manager/ComponentManager.hpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/crepe/manager/ComponentManager.hpp b/src/crepe/manager/ComponentManager.hpp
index 9e70865..6d32edb 100644
--- a/src/crepe/manager/ComponentManager.hpp
+++ b/src/crepe/manager/ComponentManager.hpp
@@ -11,8 +11,10 @@ template <class T, typename... Args>
T & ComponentManager::add_component(game_object_id_t id, Args &&... args) {
using namespace std;
- static_assert(is_base_of<Component, T>::value,
- "add_component must recieve a derivative class of Component");
+ static_assert(
+ is_base_of<Component, T>::value,
+ "add_component must recieve a derivative class of Component"
+ );
// Determine the type of T (this is used as the key of the unordered_map<>)
type_index type = typeid(T);
@@ -40,8 +42,8 @@ T & ComponentManager::add_component(game_object_id_t id, Args &&... args) {
// Check if the vector size is not greater than get_instances_max
int max_instances = instance->get_instances_max();
if (max_instances != -1 && components[type][id].size() >= max_instances) {
- throw std::runtime_error(
- "Exceeded maximum number of instances for this component type");
+ throw std::runtime_error("Exceeded maximum number of instances for this component type"
+ );
}
// store its unique_ptr in the vector<>
@@ -95,8 +97,10 @@ template <typename T>
RefVector<T> ComponentManager::get_components_by_id(game_object_id_t id) const {
using namespace std;
- static_assert(is_base_of<Component, T>::value,
- "get_components_by_id must recieve a derivative class of Component");
+ static_assert(
+ is_base_of<Component, T>::value,
+ "get_components_by_id must recieve a derivative class of Component"
+ );
type_index type = typeid(T);
if (!this->components.contains(type)) return {};
@@ -170,8 +174,8 @@ ComponentManager::get_objects_by_predicate(const std::function<bool(const T &)>
}
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 = {};