From 8d4a39087498988c8e7d31318bc8c15c0e33b4e4 Mon Sep 17 00:00:00 2001 From: tomas7770 <77364520+tomas7770@users.noreply.github.com> Date: Tue, 30 Jan 2024 18:13:30 +0000 Subject: [PATCH] fix(core): remove obsolete system validations --- core/include/cubos/core/ecs/system/system.hpp | 2 +- core/src/cubos/core/ecs/system/system.cpp | 15 +--------- core/tests/ecs/system.cpp | 29 ------------------- 3 files changed, 2 insertions(+), 44 deletions(-) diff --git a/core/include/cubos/core/ecs/system/system.hpp b/core/include/cubos/core/ecs/system/system.hpp index 7b8ccd8220..010b56ef78 100644 --- a/core/include/cubos/core/ecs/system/system.hpp +++ b/core/include/cubos/core/ecs/system/system.hpp @@ -43,7 +43,7 @@ namespace cubos::core::ecs /// A system may be invalid, if, for example, it both reads and writes the same resource. /// /// @return Whether the system is valid. - bool valid() const; + static bool valid(); /// @brief Checks if this system is compatible with another system. /// diff --git a/core/src/cubos/core/ecs/system/system.cpp b/core/src/cubos/core/ecs/system/system.cpp index bf262d1b6b..a2ae369fed 100644 --- a/core/src/cubos/core/ecs/system/system.cpp +++ b/core/src/cubos/core/ecs/system/system.cpp @@ -2,21 +2,8 @@ using namespace cubos::core::ecs; -bool SystemInfo::valid() const +bool SystemInfo::valid() { - if (this->usesWorld) - { - return !this->usesCommands && this->resourcesRead.empty() && this->resourcesWritten.empty(); - } - - for (const auto& rsc : this->resourcesRead) - { - if (this->resourcesWritten.contains(rsc)) - { - return false; - } - } - return true; } diff --git a/core/tests/ecs/system.cpp b/core/tests/ecs/system.cpp index dffb36e015..319711c285 100644 --- a/core/tests/ecs/system.cpp +++ b/core/tests/ecs/system.cpp @@ -54,35 +54,6 @@ TEST_CASE("ecs::SystemInfo") CHECK(infoA.valid()); } - SUBCASE("A is invalid") - { - SUBCASE("A reads and writes to the same resource") - { - infoA.resourcesRead.insert(typeid(int)); - infoA.resourcesWritten.insert(typeid(int)); - } - - SUBCASE("A uses the world directly and reads a resource") - { - infoA.usesWorld = true; - infoA.resourcesRead.insert(typeid(int)); - } - - SUBCASE("A uses the world directly and writes a resource") - { - infoA.usesWorld = true; - infoA.resourcesWritten.insert(typeid(int)); - } - - SUBCASE("A uses the world directly and uses commands") - { - infoA.usesWorld = true; - infoA.usesCommands = true; - } - - CHECK_FALSE(infoA.valid()); - } - SUBCASE("A and B are compatible") { SUBCASE("both do nothing")