]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/states/SelectTarget.cpp
store an application handle in each state
[l2e.git] / src / battle / states / SelectTarget.cpp
index 4645f6debd37dfaf50ad2c450c6725800b35c52d..740e46c355065da33fcfb2c27640a3976c129376 100644 (file)
@@ -20,11 +20,11 @@ using std::vector;
 namespace battle {
 
 void SelectTarget::OnEnterState(Application &c, SDL_Surface *screen) {
-       ctrl = &c;
+
 }
 
 void SelectTarget::OnExitState(Application &c, SDL_Surface *screen) {
-       ctrl = 0;
+
 }
 
 void SelectTarget::OnResumeState(Application &ctrl, SDL_Surface *screen) {
@@ -44,11 +44,11 @@ void SelectTarget::OnResize(int width, int height) {
 void SelectTarget::HandleEvents(const Input &input) {
        if (input.JustPressed(Input::ACTION_A)) {
                if (selection->CurrentIsSelected()) {
-                       ctrl->PopState(); // return control to parent
+                       Ctrl().PopState(); // return control to parent
                } else {
                        selection->Select();
                        if (selection->SelectSingle()) {
-                               ctrl->PopState(); // return control to parent
+                               Ctrl().PopState(); // return control to parent
                        }
                }
        }
@@ -57,7 +57,7 @@ void SelectTarget::HandleEvents(const Input &input) {
                        selection->Unselect();
                } else {
                        selection->UnselectAll();
-                       ctrl->PopState(); // return control to parent
+                       Ctrl().PopState(); // return control to parent
                }
        }