diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-31 14:24:24 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-31 14:24:24 +0100 |
commit | 8b2945254b143e337324ab2dfbb7d3ba7cf520d1 (patch) | |
tree | 75852aba85bb599ae6ff04767d921d5927a23b07 | |
parent | 7b0a99c4a9defcb88047a0d1d4b2a5473fdd4bd8 (diff) | |
download | RustAndDust-8b2945254b143e337324ab2dfbb7d3ba7cf520d1.zip RustAndDust-8b2945254b143e337324ab2dfbb7d3ba7cf520d1.tar.gz |
PossiblePaths: fix path.get(i)
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/PossiblePaths.java | 11 |
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) |