summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-12-30 21:48:03 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-12-30 21:48:03 +0100
commit9d5146d953453abda8cbbe35d4a42ea2ce198d90 (patch)
treeaed9af69c99a8157e7555053fd6e955f0bc7d9ad /core
parent2c58bbf094d26f755eb43ee83fad0c17854224c0 (diff)
downloadRustAndDust-9d5146d953453abda8cbbe35d4a42ea2ce198d90.zip
RustAndDust-9d5146d953453abda8cbbe35d4a42ea2ce198d90.tar.gz
Factory: add boolean assetsLoaded, to prevent reloading or wrong dispose
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/tankontank/game/battles/Factory.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/game/battles/Factory.java b/core/src/ch/asynk/tankontank/game/battles/Factory.java
index fc3f2cb..5a594d3 100644
--- a/core/src/ch/asynk/tankontank/game/battles/Factory.java
+++ b/core/src/ch/asynk/tankontank/game/battles/Factory.java
@@ -34,6 +34,7 @@ public class Factory implements Board.TileBuilder, Disposable
FAKE
}
+ public boolean assetsLoaded;
public TextureAtlas hudAtlas;
public TextureAtlas pawnsAtlas;
public TextureAtlas pawnOverlaysAtlas;
@@ -44,6 +45,7 @@ public class Factory implements Board.TileBuilder, Disposable
public Factory(final TankOnTank game)
{
this.game = game;
+ this.assetsLoaded = false;
battles = new Battle[] {
new BattleHeadToHead(this),
new BattleFrontalAssault(this),
@@ -57,15 +59,18 @@ public class Factory implements Board.TileBuilder, Disposable
public void assetsLoaded()
{
+ if (assetsLoaded) return;
this.hudAtlas = game.manager.get("data/hud.atlas", TextureAtlas.class);
this.pawnsAtlas = game.manager.get("data/units.atlas", TextureAtlas.class);
this.pawnOverlaysAtlas = game.manager.get("data/unit-overlays.atlas", TextureAtlas.class);
this.tileOverlaysAtlas = game.manager.get("data/hex-overlays.atlas", TextureAtlas.class);
+ this.assetsLoaded = false;
}
@Override
public void dispose()
{
+ if (!assetsLoaded) return;
hudAtlas.dispose();
pawnsAtlas.dispose();
pawnOverlaysAtlas.dispose();