summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/src/ch/asynk/rustanddust/engine/PathBuilder.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java
index 03b194d..524e353 100644
--- a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java
+++ b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java
@@ -259,17 +259,11 @@ public class PathBuilder implements Disposable
public boolean canExit(Orientation o)
{
- List<Path> ps;
- if (ctrlTiles.size() == 0)
- ps = paths;
- else
- ps = filteredPaths;
-
int mvt = pawn.getMovementPoints();
int cost = to.exitCost();
int rBonus = (to.road(o) ? pawn.getRoadMarchBonus() : 0);
- for (Path p : ps) {
+ for (Path p : getPaths()) {
if (pathCanExit(p, mvt, cost, rBonus))
return true;
}
@@ -284,6 +278,13 @@ public class PathBuilder implements Disposable
return false;
}
+ private List<Path> getPaths()
+ {
+ if (ctrlTiles.size() == 0)
+ return paths;
+ return filteredPaths;
+ }
+
public Path getPath(int i)
{
if (ctrlTiles.size() == 0)