summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-12-31 02:39:21 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-12-31 02:39:21 +0100
commit97e8ffc7115d100e29e50f3a80bc933eba89bd78 (patch)
tree024217c828abad70366f9ea6c4c25e8453e087d1
parent1089cee7baea6e0c66e587b1af7e88eced65b295 (diff)
downloadRustAndDust-97e8ffc7115d100e29e50f3a80bc933eba89bd78.zip
RustAndDust-97e8ffc7115d100e29e50f3a80bc933eba89bd78.tar.gz
PathBuilder: search for paths even if distance < 2
-rw-r--r--core/src/ch/asynk/rustanddust/engine/PathBuilder.java10
-rw-r--r--core/test/ch/asynk/rustanddust/BoardUtils.java2
2 files changed, 2 insertions, 10 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java
index 2d9b19c..e941632 100644
--- a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java
+++ b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java
@@ -107,15 +107,7 @@ public class PathBuilder implements Disposable
this.to = to;
// from and to are not part of the path
this.distance = board.distance(from, to);
- 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);
- }
+ findAllPaths(from, pawn.getMovementPoints(), 0, true);
// printToErr("paths", paths);
stack.clear();
diff --git a/core/test/ch/asynk/rustanddust/BoardUtils.java b/core/test/ch/asynk/rustanddust/BoardUtils.java
index a051d45..0421a7a 100644
--- a/core/test/ch/asynk/rustanddust/BoardUtils.java
+++ b/core/test/ch/asynk/rustanddust/BoardUtils.java
@@ -92,7 +92,7 @@ public class BoardUtils
public void testPathSet()
{
int n = b.buildPathBuilder(2, 2, 3, 3);
- assertTrue(n == 1);
+ assertTrue(n == 18);
n = b.buildPathBuilder(2, 2, 4, 3);
assertTrue(n == 8);