summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-05 12:53:08 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-05 12:53:08 +0100
commit0cbf952846ed77e3175754270fea1698c1e4b6e6 (patch)
treea413b573b028e5861c268163e2df229283a0fb99 /core/src
parent74f489c424a19bad3e6c76a8cd2f18e59ba2e70a (diff)
downloadRustAndDust-0cbf952846ed77e3175754270fea1698c1e4b6e6.zip
RustAndDust-0cbf952846ed77e3175754270fea1698c1e4b6e6.tar.gz
PossiblePaths: fix findAllPaths(...) roadMarch overriding when trying adjacents
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/tankontank/engine/PossiblePaths.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/PossiblePaths.java b/core/src/ch/asynk/tankontank/engine/PossiblePaths.java
index 7654e90..f3ad61a 100644
--- a/core/src/ch/asynk/tankontank/engine/PossiblePaths.java
+++ b/core/src/ch/asynk/tankontank/engine/PossiblePaths.java
@@ -105,12 +105,12 @@ public class PossiblePaths implements Iterable<Vector3>
for(int i = 0; i < 6; i++) {
Tile next = moves[i];
- if (next == null) continue;
+ if ((next == null) || next.isOffMap()) continue;
int cost = next.costFrom(pawn, board.getSide(i));
int r = (mvtLeft - cost);
- roadMarch &= next.road(board.getSide(i));
- if (roadMarch) r += pawn.getRoadMarchBonus();
+ boolean road = roadMarch & next.road(board.getSide(i));
+ if (road) r += pawn.getRoadMarchBonus();
if ((board.distance(next, to) <= r)) {
if (next == to) {
@@ -122,7 +122,7 @@ public class PossiblePaths implements Iterable<Vector3>
for (Tile tile : temp) tiles.add(tile);
} else {
stack.add(next);
- findAllPaths(next, (mvtLeft - cost), roadMarch);
+ findAllPaths(next, (mvtLeft - cost), road);
stack.remove(stack.size() - 1);
}
}