diff options
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/OrderList.java | 19 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Map.java | 3 |
2 files changed, 21 insertions, 1 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/OrderList.java b/core/src/ch/asynk/tankontank/engine/OrderList.java index 2968441..287f374 100644 --- a/core/src/ch/asynk/tankontank/engine/OrderList.java +++ b/core/src/ch/asynk/tankontank/engine/OrderList.java @@ -1,7 +1,26 @@ package ch.asynk.tankontank.engine; import java.util.LinkedList; +import java.util.Iterator; public class OrderList extends LinkedList<Order> { + public void dispose(Pawn pawn) + { + Iterator<Order> it = iterator(); + while(it.hasNext()) { + Order order = it.next(); + if (order.compareTo(pawn) == 0) { + it.remove(); + order.dispose(); + } + } + } + + public void dispose() + { + for (Order o : this) + o.dispose(); + clear(); + } } diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java index 245b7e4..2035251 100644 --- a/core/src/ch/asynk/tankontank/game/Map.java +++ b/core/src/ch/asynk/tankontank/game/Map.java @@ -120,6 +120,7 @@ public abstract class Map extends Board implements MoveToAnimationCb, ObjectiveS DiceAnimation.free(); PromoteAnimation.free(); FireAnimation.free(); + commands.dispose(); Engagement.clearPool(); } @@ -375,7 +376,7 @@ public abstract class Map extends Board implements MoveToAnimationCb, ObjectiveS throw new RuntimeException("objectives not cleared"); // FIXME do something with these Commands - orderList.clear(); + orderList.dispose(); } public void actionDone() |