summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-02 19:07:54 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-02 19:07:54 +0200
commitadf16118633c922faafe69808fa1522878461061 (patch)
tree41e1aa14ee73511da27bb5021ddcea20ef9695de /core/src
parent97c4b0a57016bf319d0b282b5f40c098474f2ed1 (diff)
downloadRustAndDust-adf16118633c922faafe69808fa1522878461061.zip
RustAndDust-adf16118633c922faafe69808fa1522878461061.tar.gz
SearchBoard: fix possiblePaths road march
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/tankontank/engine/SearchBoard.java9
1 files changed, 4 insertions, 5 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/SearchBoard.java b/core/src/ch/asynk/tankontank/engine/SearchBoard.java
index 68a2f51..6b5ef26 100644
--- a/core/src/ch/asynk/tankontank/engine/SearchBoard.java
+++ b/core/src/ch/asynk/tankontank/engine/SearchBoard.java
@@ -529,7 +529,7 @@ public class SearchBoard
Node to = getNode(col1, row1);
path.add(from);
- findAllPaths(pawn, from, to, pawn.getMovementPoints(), true, pawn.getMovementPoints());
+ findAllPaths(pawn, from, to, pawn.getMovementPoints(), true, pawn.getRoadMarchBonus());
return possiblePaths;
}
@@ -547,10 +547,9 @@ public class SearchBoard
boolean road = t.road(sides[i]);
int cost = t.costFrom(pawn, sides[i], road);
int r = (mvtLeft - cost);
- roadMarch = roadMarch & road;
- if (roadMarch) r += roadMarchBonus;
+ if (roadMarch & road) r += roadMarchBonus;
- if ((r >= 0) && (distance(next, to) <= r)) {
+ if ((distance(next, to) <= r)) {
if (next == to) {
Vector<Node> temp = new Vector<Node>(path.size() + 1);
temp.add(next);
@@ -560,7 +559,7 @@ public class SearchBoard
} else {
next.remaining = r;
path.push(next);
- findAllPaths(pawn, next, to, (mvtLeft - cost), roadMarch, roadMarchBonus);
+ findAllPaths(pawn, next, to, (mvtLeft - cost), (roadMarch & road), roadMarchBonus);
path.pop();
}
}