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/Board.java18
1 files changed, 4 insertions, 14 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java
index 50f83a8..dddb746 100644
--- a/core/src/ch/asynk/tankontank/engine/Board.java
+++ b/core/src/ch/asynk/tankontank/engine/Board.java
@@ -250,23 +250,14 @@ public abstract class Board implements Disposable
private void nodesToPoints(List<SearchBoard.Node> nodes, ArrayList<GridPoint2> points)
{
- // for (GridPoint2 point : points)
- // gridPoint2Pool.free(point);
- // points.clear();
-
- // for (SearchBoard.Node node : nodes) {
- // GridPoint2 point = gridPoint2Pool.obtain();
- // point.set(node.col, node.row);
- // points.add(point);
- // }
-
int ns = nodes.size();
int ps = points.size();
if (ps > ns) {
- for (int i = ns; i < ps; i++)
- gridPoint2Pool.free(points.get(i));
- }
+ for (int i = (ps - 1); i >= ns; i--)
+ gridPoint2Pool.free(points.remove(i));
+ } else
+ points.ensureCapacity(ns);
int i = 0;
for (SearchBoard.Node node : nodes) {
@@ -279,7 +270,6 @@ public abstract class Board implements Disposable
}
i += 1;
}
- points.ensureCapacity(ns);
}
public void possibleMovesFrom(Pawn pawn, GridPoint2 coords, ArrayList<GridPoint2> moves)