]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/BattleState.cpp
added basic defeat state
[l2e.git] / src / battle / BattleState.cpp
index 1f68acfa8bf05576202233639e008bc0d31d0c43..c6f07cd814d9247fae9caa609a14ddebc63b9a79 100644 (file)
@@ -1,6 +1,7 @@
 #include "BattleState.h"
 
 #include "PartyLayout.h"
+#include "states/DefeatState.h"
 #include "states/SelectMoveAction.h"
 #include "states/PerformAttacks.h"
 #include "states/VictoryState.h"
@@ -129,7 +130,12 @@ void BattleState::OnResumeState(SDL_Surface *screen) {
                return;
        }
        if (battle.Defeat()) {
-               Ctrl().PopState();
+               if (alreadyPushed) {
+                       Ctrl().PopState();
+               } else {
+                       Ctrl().PushState(new DefeatState(&battle, this));
+                       alreadyPushed = true;
+               }
                return;
        }
        // TODO: this should not push a state while quitting