summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-01 17:44:29 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-01 17:44:29 +0100
commita381850e22a186722c646315f594096e1e0f5669 (patch)
treefc0941a52138965c09ab33ecb366362309b48a99 /core/src/ch/asynk/tankontank
parentaa3dc8940c9ec6ac285e6792433d293b8bdd6069 (diff)
downloadRustAndDust-a381850e22a186722c646315f594096e1e0f5669.zip
RustAndDust-a381850e22a186722c646315f594096e1e0f5669.tar.gz
set new Tile overlays and cleanup usage
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-rw-r--r--core/src/ch/asynk/tankontank/game/Hex.java10
-rw-r--r--core/src/ch/asynk/tankontank/game/Map.java22
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateMove.java5
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateRotate.java4
4 files changed, 15 insertions, 26 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Hex.java b/core/src/ch/asynk/tankontank/game/Hex.java
index 4a1e2f5..47048b5 100644
--- a/core/src/ch/asynk/tankontank/game/Hex.java
+++ b/core/src/ch/asynk/tankontank/game/Hex.java
@@ -24,12 +24,10 @@ public class Hex extends Tile
public static final int FOG = 0;
public static final int SELECT = 1;
- public static final int MOVE1 = 2;
- public static final int TARGET = 3;
- public static final int MOVE2 = 4;
- public static final int DIRECTIONS = 5;
- public static final int ASSIST = 6;
- public static final int ORIENTATION = 7;
+ public static final int AREA = 2;
+ public static final int MOVE = 3;
+ public static final int DIRECTIONS = 4;
+ public static final int ORIENTATION = 5;
public Terrain terrain;
public int roads;
diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java
index 26a7e06..199868f 100644
--- a/core/src/ch/asynk/tankontank/game/Map.java
+++ b/core/src/ch/asynk/tankontank/game/Map.java
@@ -299,16 +299,16 @@ public abstract class Map extends Board
public void togglePathOverlay(Hex hex)
{
- boolean enable= !hex.isOverlayEnabled(Hex.MOVE2);
- enableOverlayOn(hex, Hex.MOVE2, enable);
+ boolean enable= !hex.isOverlayEnabled(Hex.MOVE);
+ enableOverlayOn(hex, Hex.MOVE, enable);
}
- public void showPossibleMoves() { possibleMoves.enable(Hex.MOVE1, true); }
- public void hidePossibleMoves() { possibleMoves.enable(Hex.MOVE1, false); }
- public void showPossiblePaths() { possiblePaths.enable(Hex.MOVE1, true); }
- public void hidePossiblePaths() { possiblePaths.enable(Hex.MOVE1, false); }
- public void showFinalPath(Hex dst) { possiblePaths.enable(Hex.MOVE2, true); }
- public void hideFinalPath(Hex dst) { possiblePaths.enable(Hex.MOVE2, false); }
+ public void showPossibleMoves() { possibleMoves.enable(Hex.AREA, true); }
+ public void hidePossibleMoves() { possibleMoves.enable(Hex.AREA, false); }
+ public void showPossiblePaths() { possiblePaths.enable(Hex.AREA, true); }
+ public void hidePossiblePaths() { possiblePaths.enable(Hex.AREA, false); }
+ public void showFinalPath(Hex dst) { possiblePaths.enable(Hex.MOVE, true); showMove(dst); }
+ public void hideFinalPath(Hex dst) { possiblePaths.enable(Hex.MOVE, false); hideMove(dst); }
public void showMoveablePawns() { moveablePawns.enable(Unit.MOVE, true); }
public void hideMoveablePawns() { moveablePawns.enable(Unit.MOVE, false); }
@@ -323,12 +323,10 @@ public abstract class Map extends Board
public void selectHex(Hex hex) { enableOverlayOn(hex, Hex.SELECT, true); }
public void unselectHex(Hex hex) { enableOverlayOn(hex, Hex.SELECT, false); }
+ public void showMove(Hex hex) { enableOverlayOn(hex, Hex.MOVE, true); }
+ public void hideMove(Hex hex) { enableOverlayOn(hex, Hex.MOVE, false); }
public void showDirections(Hex hex) { enableOverlayOn(hex, Hex.DIRECTIONS, true); }
public void hideDirections(Hex hex) { enableOverlayOn(hex, Hex.DIRECTIONS, false); }
- public void showTarget(Hex hex) { enableOverlayOn(hex, Hex.TARGET, true); }
- public void hideTarget(Hex hex) { enableOverlayOn(hex, Hex.TARGET, false); }
- public void showAssist(Hex hex) { enableOverlayOn(hex, Hex.ASSIST, true); }
- public void hideAssist(Hex hex) { enableOverlayOn(hex, Hex.ASSIST, false); }
public void showOrientation(Hex hex, Orientation o) { enableOverlayOn(hex, Hex.ORIENTATION, o, true); }
public void hideOrientation(Hex hex) { enableOverlayOn(hex, Hex.ORIENTATION, false); }
}
diff --git a/core/src/ch/asynk/tankontank/game/states/StateMove.java b/core/src/ch/asynk/tankontank/game/states/StateMove.java
index f1e09f8..e2ba7da 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateMove.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateMove.java
@@ -42,7 +42,6 @@ public class StateMove extends StateCommon
map.hidePossibleMoves();
map.unselectHex(activeUnit.getHex());
if (to != null) {
- map.unselectHex(to);
map.hideFinalPath(to);
}
@@ -99,7 +98,6 @@ public class StateMove extends StateCommon
private void hideAssists()
{
- map.hideAssist(selectedHex);
map.hideMoveablePawns();
}
@@ -110,7 +108,6 @@ public class StateMove extends StateCommon
activeUnit = unit;
Hex hex = activeUnit.getHex();
map.selectHex(hex);
- map.hideAssist(hex);
activeUnit.showMoveable();
map.hidePossibleMoves();
map.collectPossibleMoves(activeUnit);
@@ -121,7 +118,7 @@ public class StateMove extends StateCommon
{
to = upHex;
int s = map.collectPossiblePaths(activeUnit, to);
- map.selectHex(to);
+ map.showMove(to);
map.hidePossibleMoves();
map.showPossiblePaths();
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 975a8d5..9c856fb 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateRotate.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateRotate.java
@@ -25,8 +25,6 @@ public class StateRotate extends StateCommon
} else {
if (to == null)
System.err.println("to is null but should not be");
- // show final path
- map.selectHex(to);
map.showFinalPath(to);
}
@@ -39,7 +37,6 @@ public class StateRotate extends StateCommon
@Override
public void leave(StateType nextState)
{
- map.unselectHex(to);
map.unselectHex(activeUnit.getHex());
map.hideFinalPath(to);
map.hideDirections(to);
@@ -96,7 +93,6 @@ public class StateRotate extends StateCommon
private void hideAssists()
{
map.hideMoveablePawns();
- map.hideAssist(selectedHex);
}
private void doRotation(Orientation o)