summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/rustanddust
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-01-04 20:52:07 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2016-01-04 20:52:07 +0100
commitce4863a2b70b9ca2e6805a0f03e21dc8f04fc5b9 (patch)
tree5c3548ef8fd239844d016f17671f5bbe663b0d36 /core/src/ch/asynk/rustanddust
parent480b3f753cc68799db7ec0d440d8c995730e23c1 (diff)
downloadRustAndDust-ce4863a2b70b9ca2e6805a0f03e21dc8f04fc5b9.zip
RustAndDust-ce4863a2b70b9ca2e6805a0f03e21dc8f04fc5b9.tar.gz
StateBreak: use chooseShortest()
Diffstat (limited to 'core/src/ch/asynk/rustanddust')
-rw-r--r--core/src/ch/asynk/rustanddust/game/map/Map2Moves.java1
-rw-r--r--core/src/ch/asynk/rustanddust/game/states/StateBreak.java11
2 files changed, 6 insertions, 6 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/map/Map2Moves.java b/core/src/ch/asynk/rustanddust/game/map/Map2Moves.java
index c235de3..411e2c9 100644
--- a/core/src/ch/asynk/rustanddust/game/map/Map2Moves.java
+++ b/core/src/ch/asynk/rustanddust/game/map/Map2Moves.java
@@ -75,6 +75,7 @@ public abstract class Map2Moves extends Map1Units
public void pathsSetExit(Orientation o) { paths.setExit(o); }
public boolean pathsContains(Hex hex) { return paths.contains(hex); }
public int pathsChooseBest() { return paths.chooseBest(); }
+ public int pathsChooseShortest() { return paths.chooseShortest(); }
public int pathsToggleHex(Hex hex)
{
boolean enable = !hex.isOverlayEnabled(Hex.MOVE);
diff --git a/core/src/ch/asynk/rustanddust/game/states/StateBreak.java b/core/src/ch/asynk/rustanddust/game/states/StateBreak.java
index 631d9d2..98b6f61 100644
--- a/core/src/ch/asynk/rustanddust/game/states/StateBreak.java
+++ b/core/src/ch/asynk/rustanddust/game/states/StateBreak.java
@@ -68,11 +68,10 @@ public class StateBreak extends StateCommon
if (activeUnit == null) return;
map.pathsInit(activeUnit);
- if (map.pathsBuild(to) == 1) {
- map.pathsSetOrientation(o);
- map.moveUnit(activeUnit);
- ctrl.setAfterAnimationState(StateType.DONE);
- } else
- RustAndDust.debug("That's very wrong there should be only one path");
+ map.pathsBuild(to);
+ map.pathsChooseShortest();
+ map.pathsSetOrientation(o);
+ map.moveUnit(activeUnit);
+ ctrl.setAfterAnimationState(StateType.DONE);
}
}