X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FBattleState.cpp;h=c6f07cd814d9247fae9caa609a14ddebc63b9a79;hb=9a7ac49b7e3b7cd4a09b016ceec116830a3458f9;hp=a17732ca8c612c0c3bc810d46c73050e491e46d6;hpb=087783315ac5955c17bb3b051c9351f321653df6;p=l2e.git diff --git a/src/battle/BattleState.cpp b/src/battle/BattleState.cpp index a17732c..c6f07cd 100644 --- a/src/battle/BattleState.cpp +++ b/src/battle/BattleState.cpp @@ -1,8 +1,10 @@ #include "BattleState.h" #include "PartyLayout.h" +#include "states/DefeatState.h" #include "states/SelectMoveAction.h" #include "states/PerformAttacks.h" +#include "states/VictoryState.h" #include "../app/Application.h" #include "../app/Input.h" #include "../common/GameState.h" @@ -119,11 +121,21 @@ void BattleState::OnResumeState(SDL_Surface *screen) { return; } if (battle.Victory()) { - Ctrl().PopState(); + if (alreadyPushed) { + Ctrl().PopState(); + } else { + Ctrl().PushState(new VictoryState(&battle, this)); + alreadyPushed = true; + } 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