summaryrefslogtreecommitdiffstats
path: root/core/src/ch
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch')
-rw-r--r--core/src/ch/asynk/tankontank/game/Map.java9
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateAttack.java6
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateCommon.java2
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateMove.java10
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateRotate.java8
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateSelect.java2
6 files changed, 16 insertions, 21 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java
index 1e57c6a..e36b143 100644
--- a/core/src/ch/asynk/tankontank/game/Map.java
+++ b/core/src/ch/asynk/tankontank/game/Map.java
@@ -113,14 +113,9 @@ public abstract class Map extends Board
return possibleTargets.contains(hex);
}
- public void unselectHex(GridPoint2 hex)
+ public void selectHex(GridPoint2 hex, boolean enable)
{
- enableOverlayOn(hex, Hex.SELECT, false);
- }
-
- public void selectHex(GridPoint2 hex)
- {
- enableOverlayOn(hex, Hex.SELECT, true);
+ enableOverlayOn(hex, Hex.SELECT, enable);
}
public void showAssist(GridPoint2 hex, boolean enable)
diff --git a/core/src/ch/asynk/tankontank/game/states/StateAttack.java b/core/src/ch/asynk/tankontank/game/states/StateAttack.java
index c6aebc6..9005def 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateAttack.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateAttack.java
@@ -26,7 +26,7 @@ public class StateAttack extends StateCommon
upHex.set(to);
touchUp();
}
- map.selectHex(from);
+ map.selectHex(from, true);
}
}
@@ -35,9 +35,9 @@ public class StateAttack extends StateCommon
{
map.showAttackAssists(false);
map.showPossibleTargets(false);
- map.unselectHex(from);
+ map.selectHex(from, false);
if (to.x != -1)
- map.unselectHex(to);
+ map.selectHex(to, false);
}
@Override
diff --git a/core/src/ch/asynk/tankontank/game/states/StateCommon.java b/core/src/ch/asynk/tankontank/game/states/StateCommon.java
index df4dc56..9a647d4 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateCommon.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateCommon.java
@@ -108,7 +108,7 @@ public abstract class StateCommon implements State
{
selectedHex.set(point);
selectedPawn = map.getTopPawnAt(selectedHex);
- map.selectHex(selectedHex);
+ map.selectHex(selectedHex, true);
if (selectedPawn != null)
isEnemy = ctrl.currentPlayer().isEnemy(selectedPawn);
else
diff --git a/core/src/ch/asynk/tankontank/game/states/StateMove.java b/core/src/ch/asynk/tankontank/game/states/StateMove.java
index e8e1c3b..6e21f29 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateMove.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateMove.java
@@ -40,9 +40,9 @@ public class StateMove extends StateCommon
{
// hide all but assists : want them when in rotation
map.showPossibleMoves(false);
- map.unselectHex(from);
+ map.selectHex(from, false);
if (to.x != -1) {
- map.unselectHex(to);
+ map.selectHex(to, false);
map.showFinalPath(to, false);
}
@@ -107,12 +107,12 @@ public class StateMove extends StateCommon
{
if (from.x != -1) {
// toggle selected to assist
- map.unselectHex(from);
+ map.selectHex(from, false);
map.showAssist(from, true);
}
from.set(next);
activePawn = map.getTopPawnAt(from);
- map.selectHex(from);
+ map.selectHex(from, true);
map.showAssist(from, false);
map.showPossibleMoves(false);
map.buildPossibleMoves(activePawn, from);
@@ -123,7 +123,7 @@ public class StateMove extends StateCommon
{
to.set(upHex.x, upHex.y);
int s = map.buildPossiblePaths(activePawn, from, to);
- map.selectHex(to);
+ map.selectHex(to, true);
map.showPossibleMoves(false);
map.showPossiblePaths(true, true);
return s;
diff --git a/core/src/ch/asynk/tankontank/game/states/StateRotate.java b/core/src/ch/asynk/tankontank/game/states/StateRotate.java
index 43350df..4939fb0 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateRotate.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateRotate.java
@@ -27,11 +27,11 @@ public class StateRotate extends StateCommon
to.set(from);
} else {
// show final path
- map.selectHex(to);
+ map.selectHex(to, true);
map.showFinalPath(to, true);
}
- map.selectHex(from);
+ map.selectHex(from, true);
map.showDirections(to, true);
rotationSet = false;
@@ -40,8 +40,8 @@ public class StateRotate extends StateCommon
@Override
public void leave(StateType nextState)
{
- map.unselectHex(to);
- map.unselectHex(from);
+ map.selectHex(to, false);
+ map.selectHex(from, false);
map.showFinalPath(to, false);
map.showDirections(to, false);
map.showOrientation(to, false, o);
diff --git a/core/src/ch/asynk/tankontank/game/states/StateSelect.java b/core/src/ch/asynk/tankontank/game/states/StateSelect.java
index 10fbed1..58aad88 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateSelect.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateSelect.java
@@ -27,7 +27,7 @@ public class StateSelect extends StateCommon
@Override
public void touchDown()
{
- if (selectedHex.x != -1) map.unselectHex(selectedHex);
+ if (selectedHex.x != -1) map.selectHex(selectedHex, false);
}
@Override