summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-01-13 17:09:43 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-01-13 17:09:43 +0100
commit10385a707556764e47b2ec9c5a3d99090c6c3394 (patch)
treeabeb8ceb8987f6db78e1a11430df585e2d293bca /core
parente6fcc7c9f292dfe9abeddcd773a9921c765b577e (diff)
downloadRustAndDust-10385a707556764e47b2ec9c5a3d99090c6c3394.zip
RustAndDust-10385a707556764e47b2ec9c5a3d99090c6c3394.tar.gz
StateCommon: move checkExit from StateCommon -> StateMove
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateCommon.java16
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateMove.java16
2 files changed, 16 insertions, 16 deletions
diff --git a/core/src/ch/asynk/tankontank/game/states/StateCommon.java b/core/src/ch/asynk/tankontank/game/states/StateCommon.java
index cd230ac..a5cc875 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateCommon.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateCommon.java
@@ -1,6 +1,5 @@
package ch.asynk.tankontank.game.states;
-import ch.asynk.tankontank.game.Zone;
import ch.asynk.tankontank.game.Map;
import ch.asynk.tankontank.game.Hex;
import ch.asynk.tankontank.game.Unit;
@@ -66,19 +65,4 @@ public abstract class StateCommon implements State
map.hidePossibleTargets();
map.hideMoveableUnits();
}
-
- protected boolean checkExit(Unit unit, Hex hex)
- {
- Zone exitZone = ctrl.battle.getExitZone(unit);
- if ((exitZone == null) || !exitZone.contains(hex))
- return false;
- if (map.possiblePaths.size() == 1) {
- // TODO pathCost called with applayToPawn from Board it updates Pawn.move
- int left = (unit.getMovementPoints() - map.possiblePaths.pathCost(0));
- if (left < 1)
- return false;
- }
- ctrl.setState(StateType.ESCAPE);
- return true;
- }
}
diff --git a/core/src/ch/asynk/tankontank/game/states/StateMove.java b/core/src/ch/asynk/tankontank/game/states/StateMove.java
index c4078e2..009a877 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateMove.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateMove.java
@@ -2,6 +2,7 @@ package ch.asynk.tankontank.game.states;
import ch.asynk.tankontank.game.Hex;
import ch.asynk.tankontank.game.Unit;
+import ch.asynk.tankontank.game.Zone;
import ch.asynk.tankontank.game.hud.ActionButtons.Buttons;
public class StateMove extends StateCommon
@@ -178,4 +179,19 @@ public class StateMove extends StateCommon
return s;
}
+
+ private boolean checkExit(Unit unit, Hex hex)
+ {
+ Zone exitZone = ctrl.battle.getExitZone(unit);
+ if ((exitZone == null) || !exitZone.contains(hex))
+ return false;
+ if (map.possiblePaths.size() == 1) {
+ // TODO pathCost called with applayToPawn from Board it updates Pawn.move
+ int left = (unit.getMovementPoints() - map.possiblePaths.pathCost(0));
+ if (left < 1)
+ return false;
+ }
+ ctrl.setState(StateType.ESCAPE);
+ return true;
+ }
}