From: Daniel Karbach Date: Thu, 9 Aug 2012 12:53:25 +0000 (+0200) Subject: made application state changes yet a bit safer X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=25d7499f7923291d7287123320e7563a367e92e7;p=l2e.git made application state changes yet a bit safer --- 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 *);