summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-01-20 12:27:33 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-01-20 12:27:33 +0100
commita2bc92fdff3831991360441009792f065d550f61 (patch)
tree4a34791615243118e9782030970d9cee2ab77846
parent1f1eeb2353f2c044e91a0696a92db5a10fe24b40 (diff)
downloadRustAndDust-a2bc92fdff3831991360441009792f065d550f61.zip
RustAndDust-a2bc92fdff3831991360441009792f065d550f61.tar.gz
StateEngagement: click on attack leader to abort
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateEngage.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/src/ch/asynk/tankontank/game/states/StateEngage.java b/core/src/ch/asynk/tankontank/game/states/StateEngage.java
index c1903bd..048dbef 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateEngage.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateEngage.java
@@ -79,8 +79,10 @@ public class StateEngage extends StateCommon
{
Unit unit = upHex.getUnit();
- // activeUnit is the target
- if ((activeUnit == null) && map.possibleTargets.contains(unit)) {
+ // activeUnit is the target, selectedTarget is the engagement leader
+ if (unit == selectedUnit) {
+ ctrl.setState(StateType.ABORT);
+ } else if ((activeUnit == null) && map.possibleTargets.contains(unit)) {
// ctrl.hud.notify("Engage " + unit);
map.hidePossibleTargets();
to = upHex;