]> 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 2c82c09aa1d6cb02ec2733a043710e03fdd5e32e..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) {
@@ -50,7 +48,7 @@ void PerformAttacks::OnPauseState(Application &ctrl, SDL_Surface *screen) {
 }
 
 
-void PerformAttacks::Resize(int width, int height) {
+void PerformAttacks::OnResize(int width, int height) {
 
 }
 
@@ -62,7 +60,7 @@ void PerformAttacks::HandleEvents(const Input &input) {
        battle->ApplyDamage();
        battle->NextAttack();
        if (battle->AttacksFinished()) {
-               ctrl->PopState();
+               Ctrl().PopState();
                return;
        }