diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-02-18 12:42:22 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-02-18 12:42:22 +0100 |
commit | 9852aa74f9f727e702283ba6c90551156d6610d5 (patch) | |
tree | 7c7e93a5aad5264658da4e138c67945a1b2daa2d /core/src/ch/asynk/tankontank | |
parent | e6c5e5457bbc5a4cc0b146c40c2b4de1e5ee9fae (diff) | |
download | RustAndDust-9852aa74f9f727e702283ba6c90551156d6610d5.zip RustAndDust-9852aa74f9f727e702283ba6c90551156d6610d5.tar.gz |
Map: correctly free used Engagement
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Map.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java index ddcc237..517afc8 100644 --- a/core/src/ch/asynk/tankontank/game/Map.java +++ b/core/src/ch/asynk/tankontank/game/Map.java @@ -58,6 +58,7 @@ public abstract class Map extends Board implements MoveToAnimationCb, ObjectiveS private Sound sound; private long soundId = -1; private Animation animationClosure; + private Engagement engagement; protected abstract void setup(); @@ -315,6 +316,10 @@ public abstract class Map extends Board implements MoveToAnimationCb, ObjectiveS public void actionDone() { objectives.forget(); + if (engagement != null) { + engagement.dispose(); + engagement = null; + } } public boolean enterBoard(Unit unit, Hex to, int allowedMoves) @@ -508,9 +513,9 @@ public abstract class Map extends Board implements MoveToAnimationCb, ObjectiveS public boolean engageUnit(Unit unit, final Unit target) { attack(unit, target, true); - Engagement e = Engagement.get(unit, target); + engagement = Engagement.get(unit, target); - boolean success = resolveFight(unit, target, e); + boolean success = resolveFight(unit, target, engagement); breakUnits.clear(); for (Unit u : activatedUnits) { |