summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-04 15:45:57 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-04 15:45:57 +0200
commite6d6bc6bb8e19e409619b0a7becb7988a791eb13 (patch)
treeadc92e6fb7d8333947f79882ba26ca26ca7268ed /core/src
parent946a0935ea29d8aa88a1bc0f40a5a104b697c718 (diff)
downloadRustAndDust-e6d6bc6bb8e19e409619b0a7becb7988a791eb13.zip
RustAndDust-e6d6bc6bb8e19e409619b0a7becb7988a791eb13.tar.gz
Board: improve disposes()
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Board.java22
1 files changed, 16 insertions, 6 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java
index f1f5ca0..14f670f 100644
--- a/core/src/ch/asynk/tankontank/engine/Board.java
+++ b/core/src/ch/asynk/tankontank/engine/Board.java
@@ -81,6 +81,22 @@ public abstract class Board implements Disposable
{
}
+ @Override
+ public void dispose()
+ {
+ image.dispose();
+ for (int i = 0; i < (cfg.cols * cfg.rows); i++)
+ tiles[i].dispose();
+ tilesToDraw.clear();
+ pawnsToDraw.clear();
+ for (int i = 0, n = nextAnimations.size(); i < n; i++)
+ nextAnimations.get(i).dispose();
+ animations.clear();
+ for (int i = 0, n = animations.size(); i < n; i++)
+ animations.get(i).dispose();
+ animations.clear();
+ }
+
public Board(TileBuilder tileBuilder, Config cfg, Texture texture)
{
image = new Image(texture);
@@ -104,12 +120,6 @@ public abstract class Board implements Disposable
}
}
- @Override
- public void dispose()
- {
- image.dispose();
- }
-
public Tile getTile(GridPoint2 coords)
{
return getTile(coords.x, coords.y);