diff options
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/PossiblePaths.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/PossiblePaths.java b/core/src/ch/asynk/tankontank/engine/PossiblePaths.java index f3ad61a..cf97653 100644 --- a/core/src/ch/asynk/tankontank/engine/PossiblePaths.java +++ b/core/src/ch/asynk/tankontank/engine/PossiblePaths.java @@ -172,16 +172,16 @@ public class PossiblePaths implements Iterable<Vector3> { int cost = 0; boolean roadMarch = true; - Tile prev = null; + Tile prev = from; for (Tile next : paths.get(i)) { - if (prev != null) { - Orientation o = Orientation.fromMove(next.col, next.row, prev.col, prev.row); - cost += next.costFrom(pawn, o); - roadMarch &= next.road(o); - } + Orientation o = Orientation.fromMove(next.col, next.row, prev.col, prev.row); + cost += next.costFrom(pawn, o); + roadMarch &= next.road(o); prev = next; } + Orientation o = Orientation.fromMove(to.col, to.row, prev.col, prev.row); + cost += to.costFrom(pawn, o); if (roadMarch) cost -= pawn.getRoadMarchBonus(); |