From ce4863a2b70b9ca2e6805a0f03e21dc8f04fc5b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 4 Jan 2016 20:52:07 +0100 Subject: StateBreak: use chooseShortest() --- core/src/ch/asynk/rustanddust/game/map/Map2Moves.java | 1 + core/src/ch/asynk/rustanddust/game/states/StateBreak.java | 11 +++++------ 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); } } -- cgit v1.1-2-g2b99