summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/rustanddust/engine/PathBuilder.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java
index 8be3d79..3bc996b 100644
--- a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java
+++ b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java
@@ -107,7 +107,15 @@ public class PathBuilder implements Disposable
this.to = to;
// from and to are not part of the path
this.distance = board.distance(from, to);
- findAllPaths(from, pawn.getMovementPoints(), 0, true);
+ if (distance < 2) {
+ Orientation o = Orientation.fromMove(to.col, to.row, from.col, from.row);
+ Path path = Path.get(0);
+ path.roadMarch = to.road(o);
+ path.cost = to.costFrom(pawn, o);
+ paths.add(path);
+ } else {
+ findAllPaths(from, pawn.getMovementPoints(), 0, true);
+ }
// printToErr("paths", paths);
stack.clear();