diff options
Diffstat (limited to 'core/src/ch/asynk/rustanddust')
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/PathBuilder.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java index cae1d94..994f07d 100644 --- a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java +++ b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java @@ -190,11 +190,17 @@ public class PathBuilder implements Disposable { if (a == null) return b; - if ( (b.fitness > a.fitness) || ( - (b.fitness == a.fitness) && ( - (b.cost < a.cost) || ((b.cost == a.cost) && b.roadMarch && !a.roadMarch) - ) - )) + // better fitness or equal and ... + if ((b.fitness > a.fitness) || ((b.fitness == a.fitness) && + // smaller cost or equal and ... + ((b.cost < a.cost) || ((b.cost == a.cost) && + // roadmarch or same roadmarch and ... + ((b.roadMarch && !a.roadMarch) || ((b.roadMarch == a.roadMarch) && + // smaller + (b.tiles.size() < a.tiles.size()) + )) + )) + )) return b; return a; } |