summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/src/ch/asynk/tankontank/game/states/GameStateCommon.java15
-rw-r--r--core/src/ch/asynk/tankontank/game/states/GameStateSelect.java10
2 files changed, 16 insertions, 9 deletions
diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateCommon.java b/core/src/ch/asynk/tankontank/game/states/GameStateCommon.java
index b3d7f58..d7e17d4 100644
--- a/core/src/ch/asynk/tankontank/game/states/GameStateCommon.java
+++ b/core/src/ch/asynk/tankontank/game/states/GameStateCommon.java
@@ -93,10 +93,17 @@ public abstract class GameStateCommon implements GameState
return ((a.x == b.x) && (a.y == b.y));
}
- protected void showPossibleTargetsMovesAssists(boolean enable)
+ protected void hidePossibleTargetsMovesAssists()
{
- if (ctrl.cfg.showMoves) map.showPossibleMoves(enable);
- if (ctrl.cfg.showTargets) map.showPossibleTargets(enable);
- if (ctrl.cfg.showMoveAssists) map.showMoveAssists(enable);
+ map.showPossibleMoves(false);
+ map.showPossibleTargets(false);
+ map.showMoveAssists(false);
+ }
+
+ protected void showPossibleTargetsMovesAssists(Pawn pawn)
+ {
+ if (ctrl.cfg.showMoves && pawn.canMove()) map.showPossibleMoves(true);
+ if (ctrl.cfg.showTargets && pawn.canAttack()) map.showPossibleTargets(true);
+ if (ctrl.cfg.showMoveAssists && pawn.canMove()) map.showMoveAssists(true);
}
}
diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateSelect.java b/core/src/ch/asynk/tankontank/game/states/GameStateSelect.java
index 5ec9240..49c15fc 100644
--- a/core/src/ch/asynk/tankontank/game/states/GameStateSelect.java
+++ b/core/src/ch/asynk/tankontank/game/states/GameStateSelect.java
@@ -18,7 +18,7 @@ public class GameStateSelect extends GameStateCommon
@Override
public void leave()
{
- showPossibleTargetsMovesAssists(false);
+ hidePossibleTargetsMovesAssists();
}
@Override
@@ -30,14 +30,14 @@ public class GameStateSelect extends GameStateCommon
@Override
public void touchUp()
{
- showPossibleTargetsMovesAssists(false);
+ hidePossibleTargetsMovesAssists();
if (hasPawn()) {
int moves = map.buildPossibleMoves(pawn, hex);
int targets = map.buildPossibleTargets(pawn, hex);
int assists = map.buildMoveAssists(pawn, hex);
- showPossibleTargetsMovesAssists(true);
+ showPossibleTargetsMovesAssists(pawn);
ctrl.hud.show(
- pawn.canMove(),
+ pawn.canRotate(),
(pawn.canMove() && (moves > 0)),
(pawn.canAttack() && (targets > 0)),
false,
@@ -52,7 +52,7 @@ public class GameStateSelect extends GameStateCommon
@Override
public void abort()
{
- showPossibleTargetsMovesAssists(false);
+ hidePossibleTargetsMovesAssists();
super.abort();
}
}