diff --git a/projects/mtg/src/CardSelector.cpp b/projects/mtg/src/CardSelector.cpp index a203683e7..cf347a4b9 100644 --- a/projects/mtg/src/CardSelector.cpp +++ b/projects/mtg/src/CardSelector.cpp @@ -185,14 +185,22 @@ bool CardSelector::CheckUserInput(JButton key) return true; } Target* oldactive = active; + + int x,y; + if(JGE::GetInstance()->GetLeftClickCoordinates(x, y)) + { + active = closest (cards, limitor, static_cast (x), static_cast (y)); + } + switch (key) { case JGE_BTN_SEC: GameObserver::GetInstance()->cancelCurrentAction(); - return true; + goto switch_active; + break; case JGE_BTN_OK: GameObserver::GetInstance()->ButtonPressed(active); - return true; + goto switch_active; break; case JGE_BTN_LEFT: active = closest (cards, limitor, active); @@ -215,12 +223,7 @@ bool CardSelector::CheckUserInput(JButton key) return true; default: { - int x,y; - if(JGE::GetInstance()->GetLeftClickCoordinates(x, y)) - { - active = closest (cards, limitor, static_cast (x), static_cast (y)); - } - else + if(!JGE::GetInstance()->GetLeftClickCoordinates(x, y)) { return false; } @@ -289,6 +292,8 @@ bool CardSelector::CheckUserInput(JButton key) } } } + +switch_active: if (active != oldactive) { {