diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-04-07 09:38:13 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-04-07 09:38:13 +0200 |
commit | ea864f41947757d82c7cff199373fc0558309ab2 (patch) | |
tree | bbbbe247e27a9ee332cc77caff479e7b919d614c | |
parent | 7f5456dd68bc60febcd6ee246782da9d51aaaa72 (diff) | |
download | RustAndDust-ea864f41947757d82c7cff199373fc0558309ab2.zip RustAndDust-ea864f41947757d82c7cff199373fc0558309ab2.tar.gz |
PathBuilder: check roadMarch if fitness and cost are equal
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/PathBuilder.java | 6 |
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; } |