summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-28 16:38:55 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-28 16:38:55 +0100
commit4c6e80e4ee0cbc669a7fc160d19fa1eb8babd3fc (patch)
treea0fd0c0418468c3f232bef48ffd9f36108e868c0
parent4383cc0ba8fe4ccac0edd22aee5e7a7d88dad442 (diff)
downloadRustAndDust-4c6e80e4ee0cbc669a7fc160d19fa1eb8babd3fc.zip
RustAndDust-4c6e80e4ee0cbc669a7fc160d19fa1eb8babd3fc.tar.gz
Tile: create stack at Tile construction
-rw-r--r--core/src/ch/asynk/tankontank/engine/Tile.java6
1 files changed, 2 insertions, 4 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Tile.java b/core/src/ch/asynk/tankontank/engine/Tile.java
index 0514c6d..1c767fe 100644
--- a/core/src/ch/asynk/tankontank/engine/Tile.java
+++ b/core/src/ch/asynk/tankontank/engine/Tile.java
@@ -37,7 +37,7 @@ public abstract class Tile implements Drawable, Disposable
public Tile(float x, float y, int col, int row, TextureAtlas atlas)
{
- this.stack = null;
+ this.stack = new ArrayDeque<Pawn>();
this.x = x;
this.y = y;
this.col = col;
@@ -54,13 +54,12 @@ public abstract class Tile implements Drawable, Disposable
@Override
public void dispose()
{
- if(stack != null) stack.clear();
+ stack.clear();
overlays.dispose();
}
public boolean isEmpty()
{
- if (stack == null) return true;
return stack.isEmpty();
}
@@ -71,7 +70,6 @@ public abstract class Tile implements Drawable, Disposable
public int push(Pawn pawn)
{
- if (stack == null) stack = new ArrayDeque<Pawn>();
stack.push(pawn);
return stack.size();
}