summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-08 09:40:36 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-08 09:40:36 +0200
commitad9fe393fd55ce1b30a043882dc6731758bec84c (patch)
tree7cada90a2bf19793ca62e80732646f624d4bcb30
parent346f86a6042b629dc44bb92c0736b315570bb5e0 (diff)
downloadRustAndDust-ad9fe393fd55ce1b30a043882dc6731758bec84c.zip
RustAndDust-ad9fe393fd55ce1b30a043882dc6731758bec84c.tar.gz
GameStase*: update according to Map .possible .assits API
-rw-r--r--core/src/ch/asynk/tankontank/game/states/GameStateDirection.java2
-rw-r--r--core/src/ch/asynk/tankontank/game/states/GameStateMove.java26
-rw-r--r--core/src/ch/asynk/tankontank/game/states/GameStateSelect.java14
3 files changed, 31 insertions, 11 deletions
diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateDirection.java b/core/src/ch/asynk/tankontank/game/states/GameStateDirection.java
index 658c70a..ce9d124 100644
--- a/core/src/ch/asynk/tankontank/game/states/GameStateDirection.java
+++ b/core/src/ch/asynk/tankontank/game/states/GameStateDirection.java
@@ -39,7 +39,7 @@ public class GameStateDirection extends GameStateCommon
private void clear()
{
map.enableFinalPath(tmp, false);
- map.enableMoveAssist(false);
+ map.enableMoveAssists(false);
if (to.x != -1) unselectHex(to);
if (from.x != -1) unselectHex(to);
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 fc77f2f..91ce9e1 100644
--- a/core/src/ch/asynk/tankontank/game/states/GameStateMove.java
+++ b/core/src/ch/asynk/tankontank/game/states/GameStateMove.java
@@ -13,8 +13,7 @@ public class GameStateMove extends GameStateCommon
selectHex(hex);
skipFirst = false;
map.clearPossiblePaths();
- map.buildAndShowPossibleMoves(pawn, hex);
- map.buildAndShowMoveAssist(pawn, hex);
+ buildAndShowMoves();
}
}
@@ -26,8 +25,7 @@ public class GameStateMove extends GameStateCommon
if (hasPawn()) {
skipFirst = true;
map.clearPossiblePaths();
- map.buildAndShowPossibleMoves(pawn, hex);
- map.buildAndShowMoveAssist(pawn, hex);
+ buildAndShowMoves();
}
}
}
@@ -65,13 +63,29 @@ public class GameStateMove extends GameStateCommon
@Override
public void abort()
{
- map.enableMoveAssist(false);
+ clear();
+ super.abort();
+ }
+
+ private void buildAndShowMoves()
+ {
map.enablePossibleMoves(false);
+ map.enableMoveAssists(false);
+ map.buildPossibleMoves(pawn, hex);
+ map.buildMoveAssists(pawn, hex);
+ map.enablePossibleMoves(true);
+ map.enableMoveAssists(true);
+ }
+
+ private void clear()
+ {
+ map.enableMoveAssists(false);
+ map.enablePossibleMoves(false);
+ map.enableFinalPath(tmp, false);
if (to.x != -1) unselectHex(to);
if (from.x != -1) unselectHex(to);
to.set(-1, -1);
from.set(-1, -1);
- super.abort();
}
private int buildPaths()
diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateSelect.java b/core/src/ch/asynk/tankontank/game/states/GameStateSelect.java
index 56a1ae9..7ab4b76 100644
--- a/core/src/ch/asynk/tankontank/game/states/GameStateSelect.java
+++ b/core/src/ch/asynk/tankontank/game/states/GameStateSelect.java
@@ -25,9 +25,15 @@ public class GameStateSelect extends GameStateCommon
public void touchUp()
{
if (hasPawn()) {
- map.buildAndShowPossibleMoves(pawn, hex);
- map.buildAndShowPossibleTargets(pawn, hex);
- map.buildAndShowMoveAssist(pawn, hex);
+ map.enablePossibleMoves(false);
+ map.enablePossibleTargets(false);
+ map.enableMoveAssists(false);
+ map.buildPossibleMoves(pawn, hex);
+ map.buildPossibleTargets(pawn, hex);
+ map.buildMoveAssists(pawn, hex);
+ map.enablePossibleMoves(true);
+ map.enablePossibleTargets(true);
+ map.enableMoveAssists(true);
} else {
clear();
}
@@ -44,6 +50,6 @@ public class GameStateSelect extends GameStateCommon
{
map.enablePossibleMoves(false);
map.enablePossibleTargets(false);
- map.enableMoveAssist(false);
+ map.enableMoveAssists(false);
}
}