diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-05 12:13:57 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-05 12:13:57 +0100 |
commit | 3fdaaa05538525e828067e0eb4b91e7758ba023c (patch) | |
tree | fd99a160502a3f981a14de6db4cb050efd095731 /core/src/ch/asynk/tankontank/engine | |
parent | fbed4659a16b7e28ab960e28f11d11b841ed1d86 (diff) | |
download | RustAndDust-3fdaaa05538525e828067e0eb4b91e7758ba023c.zip RustAndDust-3fdaaa05538525e828067e0eb4b91e7758ba023c.tar.gz |
PossiblePaths: first call init(Pawn, Tile from) then build(Tile to)
Diffstat (limited to 'core/src/ch/asynk/tankontank/engine')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/PossiblePaths.java | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/PossiblePaths.java b/core/src/ch/asynk/tankontank/engine/PossiblePaths.java index bcda72b..7654e90 100644 --- a/core/src/ch/asynk/tankontank/engine/PossiblePaths.java +++ b/core/src/ch/asynk/tankontank/engine/PossiblePaths.java @@ -35,19 +35,15 @@ public class PossiblePaths implements Iterable<Vector3> this.orientation = Orientation.KEEP; } - public int init(Pawn pawn, Tile from, Tile to) + public void init(Pawn pawn, Tile from) { - clear(); this.pawn = pawn; this.from = from; - this.to = to; - - return build(); } - public int init(Pawn pawn, Tile to) + public void init(Pawn pawn) { - return init(pawn, pawn.getTile(), to); + init(pawn, pawn.getTile()); } public void clear() @@ -60,7 +56,6 @@ public class PossiblePaths implements Iterable<Vector3> this.filteredPaths.clear(); this.tiles.clear(); this.to = null; - this.pawn = null; this.orientation = Orientation.KEEP; } @@ -82,8 +77,10 @@ public class PossiblePaths implements Iterable<Vector3> board.enableOverlayOn(tile, i, enable); } - private int build() + public int build(Tile to) { + clear(); + this.to = to; // from and to are not part of the path if (board.distance(from, to) == 1) { ArrayList<Tile> temp = new ArrayList<Tile>(0); |