]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/states/SelectSpell.cpp
store an application handle in each state
[l2e.git] / src / battle / states / SelectSpell.cpp
index 6ea4675efcbbe1c381d4c70148ddec5414a630e0..623181e81265339c855fdf57cc1e1b86c661d923 100644 (file)
@@ -25,11 +25,11 @@ using graphics::Frame;
 namespace battle {
 
 void SelectSpell::OnEnterState(Application &c, SDL_Surface *screen) {
-       ctrl = &c;
+
 }
 
 void SelectSpell::OnExitState(Application &c, SDL_Surface *screen) {
-       ctrl = 0;
+
 }
 
 void SelectSpell::OnResumeState(Application &ctrl, SDL_Surface *screen) {
@@ -65,19 +65,19 @@ void SelectSpell::HandleEvents(const Input &input) {
                                ac.SetType(AttackChoice::MAGIC);
                                ac.SetSpell(spell);
                                battle->NextHero();
-                               ctrl->PopState();
+                               Ctrl().PopState();
                        } else {
                                if (spell->GetTargetingMode().TargetsSingle()) {
                                        ac.Selection().SetSingle();
                                } else {
                                        ac.Selection().SetMultiple();
                                }
-                               ctrl->PushState(new SelectTarget(battle, parent, &ac.Selection(), battle->Res().magicTargetCursor));
+                               Ctrl().PushState(new SelectTarget(battle, parent, &ac.Selection(), battle->Res().magicTargetCursor));
                        }
                }
        }
        if (input.JustPressed(Input::ACTION_B)) {
-               ctrl->PopState(); // return control to parent
+               Ctrl().PopState(); // return control to parent
        }
        if (input.JustPressed(Input::PAD_UP)) {
                battle->ActiveHero().SpellMenu().PreviousRow();