aboutsummaryrefslogtreecommitdiff
path: root/mwe/ecs-homemade
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-22 13:48:46 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-22 13:48:46 +0100
commit6a7e06f875d789af0e8f9b5ce0ad24b9eaa96d25 (patch)
tree07397ab46e2518fde4140777e2e181cde8ad938e /mwe/ecs-homemade
parent296c80edd6727d6808ed0c98c001a8b456f1c037 (diff)
parent61148c757a1f742ff09e40e5347e74e638c7371c (diff)
Merge branch 'master' into niels/UI
Diffstat (limited to 'mwe/ecs-homemade')
-rw-r--r--mwe/ecs-homemade/inc/ComponentManager.hpp4
-rw-r--r--mwe/ecs-homemade/src/ComponentManager.cpp5
2 files changed, 4 insertions, 5 deletions
diff --git a/mwe/ecs-homemade/inc/ComponentManager.hpp b/mwe/ecs-homemade/inc/ComponentManager.hpp
index af9c3a1..7d26df4 100644
--- a/mwe/ecs-homemade/inc/ComponentManager.hpp
+++ b/mwe/ecs-homemade/inc/ComponentManager.hpp
@@ -54,8 +54,8 @@ void ComponentManager::DeleteComponents() {
}
template <typename T>
-std::vector<std::reference_wrapper<T>>
-ComponentManager::GetComponentsByID(std::uint32_t id) const {
+std::vector<std::reference_wrapper<T>> ComponentManager::GetComponentsByID(std::uint32_t id
+) const {
//Determine the type of T (this is used as the key of the unordered_map<>)
std::type_index type = typeid(T);
diff --git a/mwe/ecs-homemade/src/ComponentManager.cpp b/mwe/ecs-homemade/src/ComponentManager.cpp
index 33ba12e..835bdda 100644
--- a/mwe/ecs-homemade/src/ComponentManager.cpp
+++ b/mwe/ecs-homemade/src/ComponentManager.cpp
@@ -9,9 +9,8 @@ ComponentManager::ComponentManager() {}
void ComponentManager::DeleteAllComponentsOfId(std::uint32_t id) {
for (auto & [type, componentArray] :
mComponents) { //Loop through all the types (in the unordered_map<>)
- if (id
- < componentArray
- .size()) { //Make sure that the id (that we are looking for) is within the boundaries of the vector<>
+ if (id < componentArray.size(
+ )) { //Make sure that the id (that we are looking for) is within the boundaries of the vector<>
componentArray[id].clear(); //Clear the components at this specific id
}
}