diff options
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Map.java | 8 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/states/StateSelect.java | 8 |
2 files changed, 13 insertions, 3 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java index 21f78ec..27e70bc 100644 --- a/core/src/ch/asynk/tankontank/game/Map.java +++ b/core/src/ch/asynk/tankontank/game/Map.java @@ -145,11 +145,19 @@ public abstract class Map extends Board public int buildPossibleMoves(Pawn pawn) { + if (!pawn.canMove()) { + possibleMoves.clear(); + return 0; + } return buildPossibleMoves(pawn, possibleMoves); } public int buildPossibleTargets(Pawn pawn, Iterator<Pawn> foes) { + if (!pawn.canAttack()) { + possibleTargets.clear(); + return 0; + } // return buildPossibleTargets(pawn, possibleTargets); return buildPossibleTargets(pawn, possibleTargets); } diff --git a/core/src/ch/asynk/tankontank/game/states/StateSelect.java b/core/src/ch/asynk/tankontank/game/states/StateSelect.java index 500f90d..ddddf6f 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateSelect.java +++ b/core/src/ch/asynk/tankontank/game/states/StateSelect.java @@ -52,19 +52,21 @@ public class StateSelect extends StateCommon hidePossibleTargetsMovesAssists(); if (hasUnit() && (!isEnemy || ctrl.cfg.showEnemyPossibilities)) { + // moves and targets == 0 if selectedUnit can't be activated for int moves = map.buildPossibleMoves(selectedUnit); int targets = 0; if (isEnemy) targets = map.buildPossibleTargets(selectedUnit, ctrl.player.unitIterator()); else targets = map.buildPossibleTargets(selectedUnit, ctrl.opponent.unitIterator()); - int assists = map.buildMoveAssists(selectedUnit); + if (moves > 0) + map.collectMoveablePawns(selectedUnit); showPossibleTargetsMovesAssists(selectedUnit); ctrl.hud.show( ctrl.player.canPromote(selectedUnit), selectedUnit.canMove(), - (selectedUnit.canMove() && (moves > 0)), - (selectedUnit.canAttack() && (targets > 0)), + (moves > 0), + (targets > 0), false, false ); |