diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-31 02:37:39 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-31 02:37:39 +0100 |
commit | 1089cee7baea6e0c66e587b1af7e88eced65b295 (patch) | |
tree | ac1de48558d290ca2445920baa880b6d5509bf83 | |
parent | 76e3ea905df73b2645189bb2540918103e34eb10 (diff) | |
download | RustAndDust-1089cee7baea6e0c66e587b1af7e88eced65b295.zip RustAndDust-1089cee7baea6e0c66e587b1af7e88eced65b295.tar.gz |
PathBuilder: keep looking even if target tile is reached
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/PathBuilder.java | 9 |
1 files 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); } } } |