diff --git a/src/EC/Manager.hpp b/src/EC/Manager.hpp index 064feaa..1c2a357 100644 --- a/src/EC/Manager.hpp +++ b/src/EC/Manager.hpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #ifndef NDEBUG @@ -331,13 +330,13 @@ namespace EC parameter is undefined as it is not used in that case. */ using CleanupReturnType = - std::queue >; + std::vector >; CleanupReturnType cleanup() { - CleanupReturnType changedQueue; + CleanupReturnType changedVector; if(currentSize == 0) { - return changedQueue; + return changedVector; } std::size_t rhs = currentSize - 1; @@ -350,9 +349,9 @@ namespace EC if(rhs == 0) { currentSize = 0; - return changedQueue; + return changedVector; } - changedQueue.push(std::make_tuple(false, rhs, 0)); + changedVector.push_back(std::make_tuple(false, rhs, 0)); std::get(entities[rhs]).reset(); --rhs; } @@ -365,8 +364,8 @@ namespace EC // lhs is marked for deletion // store deleted and changed id to queue - changedQueue.push(std::make_tuple(false, lhs, 0)); - changedQueue.push(std::make_tuple(true, rhs, lhs)); + changedVector.push_back(std::make_tuple(false, lhs, 0)); + changedVector.push_back(std::make_tuple(true, rhs, lhs)); // swap lhs entity with rhs entity std::swap(entities[lhs], entities.at(rhs)); @@ -384,7 +383,7 @@ namespace EC } currentSize = rhs + 1; - return changedQueue; + return changedVector; } /*! diff --git a/src/test/ECTest.cpp b/src/test/ECTest.cpp index c5d8c9a..c2d042e 100644 --- a/src/test/ECTest.cpp +++ b/src/test/ECTest.cpp @@ -443,11 +443,10 @@ TEST(EC, DeletedEntityID) manager.deleteEntity(e0); manager.deleteEntity(e1); - auto changedQueue = manager.cleanup(); + auto changedVector = manager.cleanup(); - while(!changedQueue.empty()) + for(const auto& t : changedVector) { - auto t = changedQueue.front(); if(std::get<1>(t) == 0) { EXPECT_FALSE(std::get<0>(t)); @@ -460,7 +459,6 @@ TEST(EC, DeletedEntityID) { EXPECT_TRUE(std::get<0>(t)); } - changedQueue.pop(); } EXPECT_FALSE(manager.hasEntity(2));