summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-28 07:03:45 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-28 07:03:45 +0100
commit5857400d71a678b8ea56e67969a0d151df535391 (patch)
tree3e02588bfe2741c9bca4ca8ecfedcf88a9a0aec8 /core/src
parentde1ff9b51937552250ee74e6371d46c1f8becc15 (diff)
downloadRustAndDust-5857400d71a678b8ea56e67969a0d151df535391.zip
RustAndDust-5857400d71a678b8ea56e67969a0d151df535391.tar.gz
Board: swallows ArrayList<Vector3> finalPath
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Board.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java
index ebc1cad..b8ded2d 100644
--- a/core/src/ch/asynk/tankontank/engine/Board.java
+++ b/core/src/ch/asynk/tankontank/engine/Board.java
@@ -26,7 +26,9 @@ import ch.asynk.tankontank.engine.gfx.animations.RunnableAnimation;
public abstract class Board implements Disposable
{
private final Tile neighbours[] = new Tile[6];
+ // TODO class Move : from , to, paths, points, vector, cost ...
protected List<ArrayList<SearchBoard.Node>> paths;
+ private final ArrayList<Vector3> finalPath = new ArrayList<Vector3>(10);
public interface TileBuilder
{
@@ -111,6 +113,9 @@ public abstract class Board implements Disposable
for (int i = 0, n = animations.size(); i < n; i++)
animations.get(i).dispose();
animations.clear();
+ for (Vector3 v : finalPath)
+ vector3Pool.free(v);
+ finalPath.clear();
}
public float getWidth()
@@ -422,11 +427,12 @@ public abstract class Board implements Disposable
return pawn;
}
- protected void movePawn(final Pawn pawn, int cost, ArrayList<Vector3> path, RunnableAnimation whenDone)
+ protected void movePawn(final Pawn pawn, int cost, Orientation o, RunnableAnimation whenDone)
{
+ getCoordinatePath(pawn, 0, finalPath, o);
removePawn(pawn);
- AnimationSequence seq = pawn.getMoveAnimation(path);
+ AnimationSequence seq = pawn.getMoveAnimation(finalPath);
seq.addAnimation(RunnableAnimation.get(pawn, new Runnable() {
@Override
public void run() {