diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2025-01-03 19:39:23 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2025-01-03 19:39:23 +0100 |
commit | 4f687de3530fac052f30dac7b8c59dae103bcf81 (patch) | |
tree | af02b332b6a6efced3357834cc2f30fbfe7b223b /src/crepe/manager/ComponentManager.hpp | |
parent | d65e0ff31a75230fd1c18eaeab9cb25ab2b9c82a (diff) | |
parent | 61148c757a1f742ff09e40e5347e74e638c7371c (diff) |
merge
Diffstat (limited to 'src/crepe/manager/ComponentManager.hpp')
-rw-r--r-- | src/crepe/manager/ComponentManager.hpp | 20 |
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 = {}; |