diff options
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/PathBuilder.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java index ca25535..03b194d 100644 --- a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java +++ b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java @@ -266,18 +266,24 @@ public class PathBuilder implements Disposable ps = filteredPaths; int mvt = pawn.getMovementPoints(); - int rBonus = pawn.getRoadMarchBonus(); - boolean road = to.road(o); int cost = to.exitCost(); + int rBonus = (to.road(o) ? pawn.getRoadMarchBonus() : 0); for (Path p : ps) { - int c = (p.cost + cost); - if ((c <= mvt) || (p.roadMarch && road && (c <= (mvt + rBonus)))) + if (pathCanExit(p, mvt, cost, rBonus)) return true; } return false; } + private boolean pathCanExit(Path p, int mvt, int cost, int rBonus) + { + int c = (p.cost + cost); + if ((c <= mvt) || (p.roadMarch && (c <= (mvt + rBonus)))) + return true; + return false; + } + public Path getPath(int i) { if (ctrlTiles.size() == 0) |