diff options
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 = {}; |