diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-24 10:06:48 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-24 10:06:48 +0100 |
commit | 0ac61d2b489198350425d327c0fb9e556469ad70 (patch) | |
tree | db10fd71d59bd71c7ce376958c303c4ae14a30f0 /core/src | |
parent | b39e0fe7a54fbaab18f3a7a467bd62febd268b15 (diff) | |
download | RustAndDust-0ac61d2b489198350425d327c0fb9e556469ad70.zip RustAndDust-0ac61d2b489198350425d327c0fb9e556469ad70.tar.gz |
Revert "PathBuilder: always search for path even if distance is < 2, to check for objectives"
This reverts commit 8a34706f23f479eead58a393c27e6a56eb3bcd4b.
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/PathBuilder.java | 10 |
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(); |