diff options
-rw-r--r-- | src/control/RPGEdit.cpp | 8 | ||||
-rw-r--r-- | src/control/RPGEdit.hpp | 2 |
2 files changed, 1 insertions, 9 deletions
diff --git a/src/control/RPGEdit.cpp b/src/control/RPGEdit.cpp index 0f31468..e8d71a6 100644 --- a/src/control/RPGEdit.cpp +++ b/src/control/RPGEdit.cpp @@ -74,12 +74,7 @@ void RPGEdit::systemLoop() { { std::unique_lock<std::mutex> lock(modelMutex); - uint64_t time = timeProvider.now(); - - while (time >= handledTime) { - modelCond.wait(lock); - time = timeProvider.now(); - } + uint64_t time = std::min(timeProvider.now(), handledTime); Model::Position pos = ctx->getViewPosition(time); mapView->render(pos.x, pos.y, time); @@ -102,7 +97,6 @@ void RPGEdit::eventLoop() { event.second(); handledTime = eventBus.peek(); - modelCond.notify_one(); } } } diff --git a/src/control/RPGEdit.hpp b/src/control/RPGEdit.hpp index 4279f10..d6f3aee 100644 --- a/src/control/RPGEdit.hpp +++ b/src/control/RPGEdit.hpp @@ -30,7 +30,6 @@ #include "InputHandler.hpp" #include "MapContext.hpp" -#include <condition_variable> #include <memory> #include <mutex> #include <thread> @@ -54,7 +53,6 @@ private: std::thread eventThread; std::mutex modelMutex; - std::condition_variable modelCond; uint64_t handledTime = std::numeric_limits<uint64_t>::max(); void enqueueNow(const EventBus::Event &event) { |