summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank/engine
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-08 00:50:27 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-08 08:34:43 +0200
commit5a55d4e4f66869b02fca79ead61e6e5d2a2915db (patch)
tree34b3461de08c98247e980f84ac1f11659486bdc2 /core/src/ch/asynk/tankontank/engine
parente55c335fd396da5b5c3ba46379504ba9fda08c6e (diff)
downloadRustAndDust-5a55d4e4f66869b02fca79ead61e6e5d2a2915db.zip
RustAndDust-5a55d4e4f66869b02fca79ead61e6e5d2a2915db.tar.gz
SearchBoard: possibleMovesFrom fix road march
- do not update remaing when pushing onto raodMarch stack - another copy of might still be in the regular stack and then pop out with a bigger movement than it should
Diffstat (limited to 'core/src/ch/asynk/tankontank/engine')
-rw-r--r--core/src/ch/asynk/tankontank/engine/SearchBoard.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/SearchBoard.java b/core/src/ch/asynk/tankontank/engine/SearchBoard.java
index 26b05b5..6f22f74 100644
--- a/core/src/ch/asynk/tankontank/engine/SearchBoard.java
+++ b/core/src/ch/asynk/tankontank/engine/SearchBoard.java
@@ -159,11 +159,11 @@ public class SearchBoard
while (stack.size() != 0) {
Node src = stack.pop();
- if (src.remaining <= 0) {
- if (src.roadMarch) {
- src.remaining = roadMarchBonus;
+ if (src.remaining < 0)
+ continue;
+ if (src.remaining == 0) {
+ if (src.roadMarch)
roadMarch.push(src);
- }
continue;
}
@@ -206,6 +206,7 @@ public class SearchBoard
first = false;
}
+ for (Node n : roadMarch) n.remaining = roadMarchBonus;
while(roadMarch.size() != 0) {
Node src = roadMarch.pop();