From 1089cee7baea6e0c66e587b1af7e88eced65b295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 31 Dec 2015 02:37:39 +0100 Subject: PathBuilder: keep looking even if target tile is reached --- core/src/ch/asynk/rustanddust/engine/PathBuilder.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java index ae4c3fb..2d9b19c 100644 --- a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java +++ b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java @@ -164,7 +164,7 @@ public class PathBuilder implements Disposable int l = (m + (r ? pawn.getRoadMarchBonus() : 0)); - if ((board.distance(next, to) <= l)) { + if (board.distance(next, to) <= l) { if (next == to) { Path path = Path.get(stack.size() + 1); for (Tile t: stack) { @@ -175,11 +175,10 @@ public class PathBuilder implements Disposable path.fitness = f; path.cost = (pawn.getMovementPoints() - m); paths.add(path); - } else { - stack.add(next); - findAllPaths(next, m, f, r); - stack.remove(stack.size() - 1); } + stack.add(next); + findAllPaths(next, m, f, r); + stack.remove(stack.size() - 1); } } } -- cgit v1.1-2-g2b99