diff --git a/src/ECS/Systems/Systems.cpp b/src/ECS/Systems/Systems.cpp index 5a714e69..ce11910f 100644 --- a/src/ECS/Systems/Systems.cpp +++ b/src/ECS/Systems/Systems.cpp @@ -100,14 +100,15 @@ namespace Systems { } } - bool executeDeadFunc(std::size_t id, Registry::components &arrDead) + bool + executeDeadFunc(std::size_t id, Registry::components &arrDead) { std::cout << "----------------------------------" << std::endl; // AVANT DE SUPPRIMER, JE REGARDE QUELLES ENTITES EXISTES Registry::components arrHealth1 = Registry::getInstance().getComponents(); - + std::vector ids1 = arrHealth1.getExistingsId(); for (auto itIds1 = ids1.begin(); itIds1 != ids1.end(); itIds1++) { std::cout << "There is an entity with id " << *itIds1 << std::endl; @@ -137,19 +138,22 @@ namespace Systems { Registry::getInstance().getComponents(); Registry::components arrDead = Registry::getInstance().getComponents(); - + bool isEntityRemoved = false; std::vector ids = arrHealth.getExistingsId(); for (auto itIds = ids.begin(); itIds != ids.end(); itIds++) { - if (arrHealth.exist(*itIds) && arrHealth[*itIds].hp <= 0 && arrDead.exist(*itIds)) { + if (arrHealth.exist(*itIds) && arrHealth[*itIds].hp <= 0 + && arrDead.exist(*itIds)) { isEntityRemoved = executeDeadFunc(*itIds, arrDead); if (isEntityRemoved) { - arrHealth = Registry::getInstance().getComponents(); - arrDead = Registry::getInstance().getComponents(); - ids = arrHealth.getExistingsId(); + arrHealth = + Registry::getInstance().getComponents(); + arrDead = + Registry::getInstance().getComponents(); + ids = arrHealth.getExistingsId(); itIds = ids.begin(); - //if empty, return + // if empty, return if (itIds == ids.end()) { return; }