]> git.localhorst.tv Git - l2e.git/blobdiff - src/app/Application.cpp
added forwarding headers
[l2e.git] / src / app / Application.cpp
index 819882e7251f43e66b7ed77311f97c498e74d456..4c8c5747ff71dd5620fe2a6d26c96fdf0efc4e03 100644 (file)
@@ -28,7 +28,7 @@ Application::~Application() {
 
 
 State *Application::CurrentState() {
-       return states.top();
+       return states.empty() ? 0 : states.top();
 }
 
 void Application::UpdateState() {
@@ -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();
        }
 }
 
@@ -121,7 +124,7 @@ void Application::Loop() {
        Uint32 now(SDL_GetTicks());
        Uint32 deltaT(now - last);
        GlobalTimers().Update(deltaT);
-       if (deltaT > 34) deltaT = 34;
+       if (deltaT > 30) deltaT = 30;
 
        if (CurrentState()) {
                CurrentState()->GraphicsTimers().Update(deltaT);
@@ -159,7 +162,7 @@ void Application::HandleEvents() {
                                break;
                }
        }
-       CurrentState()->HandleEvents(input);
+       if (CurrentState()) CurrentState()->HandleEvents(input);
 }
 
 void Application::UpdateWorld(Uint32 deltaT) {