summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r--core/src/ch/asynk/tankontank/engine/PossiblePaths.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/PossiblePaths.java b/core/src/ch/asynk/tankontank/engine/PossiblePaths.java
index 7f2d430..8a3879c 100644
--- a/core/src/ch/asynk/tankontank/engine/PossiblePaths.java
+++ b/core/src/ch/asynk/tankontank/engine/PossiblePaths.java
@@ -189,13 +189,20 @@ public class PossiblePaths implements Iterable<Vector3>
return cost;
}
+ private List<Tile> getPath(int i)
+ {
+ if (ctrlTiles.size() == 0)
+ return paths.get(0);
+ return filteredPaths.get(0);
+ }
+
public int pathSteps(int idx)
{
int steps = 0;
Tile tile = pawn.getTile();
Orientation o = pawn.getOrientation();
- for (Tile next : filteredPaths.get(idx)) {
+ for (Tile next : getPath(idx)) {
Orientation nextO = Orientation.fromMove(tile.col, tile.row, next.col, next.row);
if (nextO != o) {
steps += 2;
@@ -215,7 +222,7 @@ public class PossiblePaths implements Iterable<Vector3>
@Override
public Iterator<Vector3> iterator()
{
- return new Vector3Iterator(pawn, to, lastO, filteredPaths.get(0));
+ return new Vector3Iterator(pawn, to, lastO, getPath(0));
}
private void printToErr(String what, List<ArrayList<Tile>> paths)