summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/rustanddust/engine
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk/rustanddust/engine')
-rw-r--r--core/src/ch/asynk/rustanddust/engine/PathBuilder.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java
index 9955b92..28527d7 100644
--- a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java
+++ b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java
@@ -106,13 +106,15 @@ public class PathBuilder implements Disposable
clear();
this.to = to;
// from and to are not part of the path
- this.distance = board.distance(from, to);
- if (distance == 0) {
+ if (from == to) {
+ this.distance = 0;
Path path = Path.get(0);
path.cost = 0;
paths.add(path);
- } else
+ } else {
+ this.distance = board.distance(from, to);
findAllPaths(from, pawn.getMovementPoints(), 0, true);
+ }
// printToErr("paths", paths);
stack.clear();