From ea864f41947757d82c7cff199373fc0558309ab2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 7 Apr 2016 09:38:13 +0200 Subject: PathBuilder: check roadMarch if fitness and cost are equal --- core/src/ch/asynk/rustanddust/engine/PathBuilder.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; } -- cgit v1.1-2-g2b99