summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-08 22:30:48 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-08 22:30:48 +0200
commit3d5fc509f7e524abc3b606ff1d579e9ad747c711 (patch)
treed4deb9e6f9322d04b81cd0739e9e784cca8b9e32 /core/src
parentfbdf0bc1e1c1e3c243d200e2e00e3de36a7abee0 (diff)
downloadRustAndDust-3d5fc509f7e524abc3b606ff1d579e9ad747c711.zip
RustAndDust-3d5fc509f7e524abc3b606ff1d579e9ad747c711.tar.gz
Map: change enableXyz into showXyz
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/tankontank/game/Map.java58
-rw-r--r--core/src/ch/asynk/tankontank/game/states/GameStateCommon.java6
-rw-r--r--core/src/ch/asynk/tankontank/game/states/GameStateDirection.java6
-rw-r--r--core/src/ch/asynk/tankontank/game/states/GameStateMove.java22
-rw-r--r--core/src/ch/asynk/tankontank/game/states/GameStateRotate.java4
5 files changed, 48 insertions, 48 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java
index 8048576..ae859eb 100644
--- a/core/src/ch/asynk/tankontank/game/Map.java
+++ b/core/src/ch/asynk/tankontank/game/Map.java
@@ -70,25 +70,25 @@ public abstract class Map extends Board
return possibleTargets.contains(hex);
}
- public void enablePossibleMoves(boolean enable)
+ public void showPossibleMoves(boolean enable)
{
for(GridPoint2 hex : possibleMoves)
enableOverlayOn(hex, Hex.MOVE1, enable);
}
- public void enableMoveAssists(boolean enable)
+ public void showMoveAssists(boolean enable)
{
for(GridPoint2 hex : moveAssists)
enableOverlayOn(hex, Hex.ASSIST, enable);
}
- public void enablePossibleTargets(boolean enable)
+ public void showPossibleTargets(boolean enable)
{
for(GridPoint2 hex : possibleTargets)
enableOverlayOn(hex, Hex.TARGET, enable);
}
- public void enablePossiblePaths(boolean enable, boolean keepFinal)
+ public void showPossiblePaths(boolean enable, boolean keepFinal)
{
if (keepFinal) {
for(GridPoint2 hex : possiblePaths)
@@ -101,6 +101,31 @@ public abstract class Map extends Board
}
}
+ public void showFinalPath(GridPoint2 dst, boolean enable)
+ {
+ for(GridPoint2 hex : possiblePaths) {
+ enableOverlayOn(hex, Hex.MOVE1, false);
+ enableOverlayOn(hex, Hex.MOVE2, enable);
+ }
+ showDirections(dst, enable);
+ }
+
+ public void showDirections(GridPoint2 hex, boolean enable)
+ {
+ enableOverlayOn(hex, Hex.DIRECTIONS, enable);
+ }
+
+ public int possiblePathsSize()
+ {
+ return possiblePaths.size();
+ }
+
+ public void togglePathOverlay(GridPoint2 hex)
+ {
+ boolean enable= !isOverlayEnabledOn(hex, Hex.MOVE2);
+ enableOverlayOn(hex, Hex.MOVE2, enable);
+ }
+
public int buildPossibleMoves(Pawn pawn, GridPoint2 hex)
{
buildPossibleMovesFrom(pawn, hex, possibleMoves);
@@ -123,11 +148,6 @@ public abstract class Map extends Board
return moveAssists.size();
}
- public int possiblePathsSize()
- {
- return possiblePaths.size();
- }
-
public int buildPossiblePaths(Pawn pawn, GridPoint2 from, GridPoint2 to)
{
return possiblePaths(pawn, from, to, possiblePaths);
@@ -150,21 +170,6 @@ public abstract class Map extends Board
clearPointVector(possibleTargets);
}
- public void togglePathOverlay(GridPoint2 hex)
- {
- boolean enable= !isOverlayEnabledOn(hex, Hex.MOVE2);
- enableOverlayOn(hex, Hex.MOVE2, enable);
- }
-
- public void enableFinalPath(GridPoint2 dst, boolean enable)
- {
- for(GridPoint2 hex : possiblePaths) {
- enableOverlayOn(hex, Hex.MOVE1, false);
- enableOverlayOn(hex, Hex.MOVE2, enable);
- }
- enableDirections(dst, enable);
- }
-
public void movePawn(Pawn pawn, Orientation o)
{
int s = getCoordinatePath(pawn, finalPath, o);
@@ -187,9 +192,4 @@ public abstract class Map extends Board
}
}));
}
-
- public void enableDirections(GridPoint2 hex, boolean enable)
- {
- enableOverlayOn(hex, Hex.DIRECTIONS, enable);
- }
}
diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateCommon.java b/core/src/ch/asynk/tankontank/game/states/GameStateCommon.java
index 04708f8..b3d7f58 100644
--- a/core/src/ch/asynk/tankontank/game/states/GameStateCommon.java
+++ b/core/src/ch/asynk/tankontank/game/states/GameStateCommon.java
@@ -95,8 +95,8 @@ public abstract class GameStateCommon implements GameState
protected void showPossibleTargetsMovesAssists(boolean enable)
{
- if (ctrl.cfg.showMoves) map.enablePossibleMoves(enable);
- if (ctrl.cfg.showTargets) map.enablePossibleTargets(enable);
- if (ctrl.cfg.showMoveAssists) map.enableMoveAssists(enable);
+ if (ctrl.cfg.showMoves) map.showPossibleMoves(enable);
+ if (ctrl.cfg.showTargets) map.showPossibleTargets(enable);
+ if (ctrl.cfg.showMoveAssists) map.showMoveAssists(enable);
}
}
diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateDirection.java b/core/src/ch/asynk/tankontank/game/states/GameStateDirection.java
index 7687e91..eb6f22c 100644
--- a/core/src/ch/asynk/tankontank/game/states/GameStateDirection.java
+++ b/core/src/ch/asynk/tankontank/game/states/GameStateDirection.java
@@ -7,14 +7,14 @@ public class GameStateDirection extends GameStateCommon
@Override
public void enter()
{
- map.enableFinalPath(to, true);
+ map.showFinalPath(to, true);
}
@Override
public void leave()
{
- map.enableMoveAssists(false);
- map.enableFinalPath(to, false);
+ map.showMoveAssists(false);
+ map.showFinalPath(to, false);
if (to.x != -1) unselectHex(to);
if (from.x != -1) unselectHex(from);
to.set(-1, -1);
diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateMove.java b/core/src/ch/asynk/tankontank/game/states/GameStateMove.java
index 7e69676..110e3c6 100644
--- a/core/src/ch/asynk/tankontank/game/states/GameStateMove.java
+++ b/core/src/ch/asynk/tankontank/game/states/GameStateMove.java
@@ -40,15 +40,15 @@ public class GameStateMove extends GameStateCommon
@Override
public void abort()
{
- map.enableMoveAssists(false);
- map.enablePossibleMoves(false);
+ map.showMoveAssists(false);
+ map.showPossibleMoves(false);
if (from.x != -1) {
unselectHex(from);
from.set(-1, -1);
}
if (to.x != -1) {
unselectHex(to);
- map.enableFinalPath(to, false);
+ map.showFinalPath(to, false);
to.set(-1, -1);
}
super.abort();
@@ -56,12 +56,12 @@ public class GameStateMove extends GameStateCommon
private void buildAndShowMoves()
{
- map.enablePossibleMoves(false);
- map.enableMoveAssists(false);
+ map.showPossibleMoves(false);
+ map.showMoveAssists(false);
map.buildPossibleMoves(pawn, hex);
map.buildMoveAssists(pawn, hex);
- map.enablePossibleMoves(true);
- map.enableMoveAssists(true);
+ map.showPossibleMoves(true);
+ map.showMoveAssists(true);
}
private int buildPaths()
@@ -70,8 +70,8 @@ public class GameStateMove extends GameStateCommon
to.set(upHex.x, upHex.y);
int s = map.buildPossiblePaths(pawn, from, to);
selectHex(to);
- map.enablePossibleMoves(false);
- map.enablePossiblePaths(true, true);
+ map.showPossibleMoves(false);
+ map.showPossiblePaths(true, true);
return s;
}
@@ -82,10 +82,10 @@ public class GameStateMove extends GameStateCommon
} else if (sameHexes(downHex, to)) {
//
} else {
- map.enablePossiblePaths(false, true);
+ map.showPossiblePaths(false, true);
map.togglePathOverlay(downHex);
s = map.possiblePathsPointToggle(downHex);
- map.enablePossiblePaths(true, true);
+ map.showPossiblePaths(true, true);
}
return s;
diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateRotate.java b/core/src/ch/asynk/tankontank/game/states/GameStateRotate.java
index 9296157..7a200d2 100644
--- a/core/src/ch/asynk/tankontank/game/states/GameStateRotate.java
+++ b/core/src/ch/asynk/tankontank/game/states/GameStateRotate.java
@@ -7,7 +7,7 @@ public class GameStateRotate extends GameStateCommon
@Override
public void enter()
{
- map.enableDirections(hex, true);
+ map.showDirections(hex, true);
ctrl.hud.show(true, false, false, true, true);
}
@@ -15,7 +15,7 @@ public class GameStateRotate extends GameStateCommon
public void leave()
{
unselectHex(hex);
- map.enableDirections(hex, false);
+ map.showDirections(hex, false);
}
@Override