summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-12 22:31:38 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-12 22:31:38 +0100
commitdba570673b67972cf36d35ae8cd8667e31ba974e (patch)
tree06b940d0f531d3ec2fa8824aa3187bf11dd1def6 /core/src/ch/asynk
parent60e6f04e48b1b232632dfd579247e8a15c9635f6 (diff)
downloadRustAndDust-dba570673b67972cf36d35ae8cd8667e31ba974e.zip
RustAndDust-dba570673b67972cf36d35ae8cd8667e31ba974e.tar.gz
StateReinforcement: abort if no entry point found
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateReinforcement.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/core/src/ch/asynk/tankontank/game/states/StateReinforcement.java b/core/src/ch/asynk/tankontank/game/states/StateReinforcement.java
index c8cb901..21f4768 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateReinforcement.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateReinforcement.java
@@ -24,6 +24,8 @@ public class StateReinforcement extends StateCommon
@Override
public void leave(StateType nextState)
{
+ if (selectedHex != null)
+ map.unselectHex(selectedHex);
if (entryPoint != null)
entryPoint.enable(Hex.AREA, false);
ctrl.hud.playerInfo.unitDock.hide();
@@ -74,10 +76,14 @@ public class StateReinforcement extends StateCommon
map.selectHex(selectedHex);
entryPoint.enable(Hex.AREA, false);
ctrl.player.unitEntry(unit);
- map.enterBoard(unit, upHex, entryPoint.allowedMoves);
- if (unit.getMovementPoints() > 0)
- ctrl.setState(StateType.MOVE, true);
- else
- ctrl.setState(StateType.ROTATE, true);
+ if (map.enterBoard(unit, upHex, entryPoint.allowedMoves)) {
+ if (unit.getMovementPoints() > 0)
+ ctrl.setState(StateType.MOVE, true);
+ else
+ ctrl.setState(StateType.ROTATE, true);
+ } else {
+ ctrl.hud.notify("Impossible to enter map at that position");
+ abort();
+ }
}
}