diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-02-18 21:34:05 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-02-18 21:34:05 +0100 |
commit | 611b4730a9ab19061dbf513ac8da745fc1d730a8 (patch) | |
tree | 2cf6ffe51796ce45dfc9252f00d02d967930abba /core/src/ch/asynk/tankontank/engine | |
parent | 50c7bb777aa3608a359d196fe26ef2cdd63db76d (diff) | |
download | RustAndDust-611b4730a9ab19061dbf513ac8da745fc1d730a8.zip RustAndDust-611b4730a9ab19061dbf513ac8da745fc1d730a8.tar.gz |
OrderList: add dispose(), dispose(Pawn)
Diffstat (limited to 'core/src/ch/asynk/tankontank/engine')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/OrderList.java | 19 |
1 files changed, 19 insertions, 0 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(); + } } |