From 3eccd38e989012ff35ee5376670aabc338c52008 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Sun, 12 Feb 2017 17:07:55 -0500 Subject: locked EM.each, arenas --- include/engine.hpp | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) (limited to 'include') diff --git a/include/engine.hpp b/include/engine.hpp index 112fd3c..5824950 100644 --- a/include/engine.hpp +++ b/include/engine.hpp @@ -65,36 +65,6 @@ public: } }; -class LockableEntityManager : public entityx::EntityManager { -private: - std::atomic_bool locked; - -public: - LockableEntityManager(entityx::EventManager& ev) - : EntityManager(ev) { - locked.store(false); - } - - void lock(void) { - while (locked.load()) - std::this_thread::sleep_for(std::chrono::milliseconds(10)); - - locked.store(true); - } - - void unlock(void) { - locked.store(false); - } - - bool try_lock(void) { - if (locked.load()) - return false; - - locked.store(true); - return true; - } -}; - namespace game { /** * Handles all game events. @@ -104,7 +74,7 @@ namespace game { /** * Handles entity data. */ - extern LockableEntityManager entities; + extern entityx::EntityManager entities; /** * An instance of the main game engine. -- cgit v1.2.3