]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/states/PerformAttacks.cpp
store an application handle in each state
[l2e.git] / src / battle / states / PerformAttacks.cpp
index 50c7b1443ad9b4dd1e3ccafaefac567755df9df3..a1a5b8b260226a5ad816765b1d14e419417f9582 100644 (file)
@@ -30,7 +30,6 @@ using std::vector;
 namespace battle {
 
 void PerformAttacks::OnEnterState(Application &c, SDL_Surface *screen) {
-       ctrl = &c;
        battle->CalculateAttackOrder();
        numberAnimation.reserve(battle->MaxMonsters() > battle->NumHeroes() + 1 ? battle->MaxMonsters() : battle->NumHeroes() + 1);
        numberPosition.reserve(numberAnimation.size());
@@ -38,7 +37,6 @@ void PerformAttacks::OnEnterState(Application &c, SDL_Surface *screen) {
 
 void PerformAttacks::OnExitState(Application &c, SDL_Surface *screen) {
        battle->ClearAllAttacks();
-       ctrl = 0;
 }
 
 void PerformAttacks::OnResumeState(Application &ctrl, SDL_Surface *screen) {
@@ -62,7 +60,7 @@ void PerformAttacks::HandleEvents(const Input &input) {
        battle->ApplyDamage();
        battle->NextAttack();
        if (battle->AttacksFinished()) {
-               ctrl->PopState();
+               Ctrl().PopState();
                return;
        }