]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/BattleState.cpp
added dummy state that echoes all selected attacks
[l2e.git] / src / battle / BattleState.cpp
index c294e1a28feda13da5b9f81be3b9e15aa4aecdc3..b5c91f8ca6b03587bf9605111ed0e6814097e1c9 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "PartyLayout.h"
 #include "states/SelectMoveAction.h"
+#include "states/PerformAttacks.h"
 #include "../app/Application.h"
 #include "../app/Input.h"
 #include "../common/Ikari.h"
@@ -180,6 +181,7 @@ void BattleState::LoadInventory() {
                        itemMenu.AddEmptyEntry();
                }
        }
+       ClearAllAttacks();
 }
 
 void BattleState::ExitState(Application &ctrl, SDL_Surface *screen) {
@@ -192,12 +194,11 @@ void BattleState::ResumeState(Application &ctrl, SDL_Surface *screen) {
                ctrl.PopState(); // quit the battle scene
                return;
        }
-       // reset attack choices
-       activeHero = -1;
-       for (vector<Hero>::size_type i(0), end(heroes.size()); i < end; ++i) {
-               attackChoices[i] = AttackChoice(this);
+       if (AttackSelectionDone()) {
+               ctrl.PushState(new PerformAttacks(this));
+       } else {
+               ctrl.PushState(new SelectMoveAction(this));
        }
-       ctrl.PushState(new SelectMoveAction(this));
 }
 
 void BattleState::PauseState(Application &ctrl, SDL_Surface *screen) {
@@ -205,6 +206,14 @@ void BattleState::PauseState(Application &ctrl, SDL_Surface *screen) {
 }
 
 
+void BattleState::ClearAllAttacks() {
+       activeHero = -1;
+       for (vector<Hero>::size_type i(0), end(heroes.size()); i < end; ++i) {
+               attackChoices[i] = AttackChoice(this);
+       }
+}
+
+
 void BattleState::HandleEvents(const Input &input) {
 
 }