From 25d7499f7923291d7287123320e7563a367e92e7 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Thu, 9 Aug 2012 14:53:25 +0200 Subject: [PATCH] made application state changes yet a bit safer --- src/app/Application.cpp | 6 ++++-- src/app/Application.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/Application.cpp b/src/app/Application.cpp index 80ebb5d..29eaee7 100644 --- a/src/app/Application.cpp +++ b/src/app/Application.cpp @@ -123,8 +123,10 @@ void Application::Loop() { if (deltaT > 34) deltaT = 34; HandleEvents(); - UpdateWorld(deltaT); - Render(); + if (!StateChangePending()) { + UpdateWorld(deltaT); + Render(); + } last = now; UpdateState(); diff --git a/src/app/Application.h b/src/app/Application.h index 853d0cb..5e9e888 100644 --- a/src/app/Application.h +++ b/src/app/Application.h @@ -51,6 +51,7 @@ private: private: State *CurrentState(); + bool StateChangePending() const { return !stateChanges.empty(); } void UpdateState(); void RealChangeState(State *); void RealPushState(State *); -- 2.39.2