summaryrefslogtreecommitdiffstats
path: root/core/src/ch
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-04-07 09:38:13 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2016-04-07 09:38:13 +0200
commitea864f41947757d82c7cff199373fc0558309ab2 (patch)
treebbbbe247e27a9ee332cc77caff479e7b919d614c /core/src/ch
parent7f5456dd68bc60febcd6ee246782da9d51aaaa72 (diff)
downloadRustAndDust-ea864f41947757d82c7cff199373fc0558309ab2.zip
RustAndDust-ea864f41947757d82c7cff199373fc0558309ab2.tar.gz
PathBuilder: check roadMarch if fitness and cost are equal
Diffstat (limited to 'core/src/ch')
-rw-r--r--core/src/ch/asynk/rustanddust/engine/PathBuilder.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java
index 50e4e79..e89e237 100644
--- a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java
+++ b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java
@@ -184,7 +184,11 @@ public class PathBuilder implements Disposable
{
if (a == null)
return b;
- if ( (b.fitness > a.fitness) || ((b.fitness == a.fitness) && (b.cost < a.cost)))
+ if ( (b.fitness > a.fitness) || (
+ (b.fitness == a.fitness) && (
+ (b.cost < a.cost) || ((b.cost == a.cost) && b.roadMarch && !a.roadMarch)
+ )
+ ))
return b;
return a;
}