diff options
author | Max-001 <80035972+Max-001@users.noreply.github.com> | 2024-10-02 17:01:47 +0200 |
---|---|---|
committer | Max-001 <80035972+Max-001@users.noreply.github.com> | 2024-10-02 17:01:47 +0200 |
commit | 8b69b8cb28f0ef43d1039b7616ca893344e236cd (patch) | |
tree | 4bf43556f056cb04a047187fc5e67ea6bc4f0bc8 /mwe/ecs-homemade/src/ComponentManager.cpp | |
parent | 0b6a5731401348ab5931a80e07e134ae460d9955 (diff) |
Added DeleteAllComponentsOfId methode
Diffstat (limited to 'mwe/ecs-homemade/src/ComponentManager.cpp')
-rw-r--r-- | mwe/ecs-homemade/src/ComponentManager.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/mwe/ecs-homemade/src/ComponentManager.cpp b/mwe/ecs-homemade/src/ComponentManager.cpp index def50be..16cc2b6 100644 --- a/mwe/ecs-homemade/src/ComponentManager.cpp +++ b/mwe/ecs-homemade/src/ComponentManager.cpp @@ -9,7 +9,11 @@ ComponentManager& ComponentManager::GetInstance() { 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<> + componentArray[id].clear(); //Clear the components at this specific id + } + } } void ComponentManager::DeleteAllComponents() { |