X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2FApplication.cpp;h=4ff75d8ed10c1104f9abf38142b4ffe46c9d3a5a;hb=616330670a0c3d9d4554c145e997129747d05979;hp=6e46203aa94184de00c55d90ff41025b7433d12d;hpb=8456b7dac2051bfd2b507a39854c1428eb4d91cd;p=l2e.git diff --git a/src/app/Application.cpp b/src/app/Application.cpp index 6e46203..4ff75d8 100644 --- a/src/app/Application.cpp +++ b/src/app/Application.cpp @@ -106,7 +106,10 @@ void Application::Quit() { void Application::PopAllStates() { while (!states.empty()) { - RealPopState(); + states.top()->PauseState(*this, screen->Screen()); + states.top()->ExitState(*this, screen->Screen()); + delete states.top(); + states.pop(); } } @@ -159,12 +162,12 @@ void Application::HandleEvents() { break; } } - CurrentState()->HandleEvents(input); + if (CurrentState()) CurrentState()->HandleEvents(input); } void Application::UpdateWorld(Uint32 deltaT) { if (!CurrentState()) return; - for (Uint32 i(0); i < deltaT; ++i) { + for (Uint32 i(0); i < deltaT && !StateChangePending(); ++i) { CurrentState()->PhysicsTimers().Update(0.001f); CurrentState()->UpdateWorld(0.001f); }