summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-02-19 00:22:07 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-02-19 00:22:07 +0100
commite518b17f855549d540d4aa6bad2c2a785521a106 (patch)
tree674b23d8f3c7b75aa4f6295cde1e33e64b446acd /core/src/ch/asynk/tankontank
parent0db9753ccf10b06c083dd24d2c1e0b2064f9afd3 (diff)
downloadRustAndDust-e518b17f855549d540d4aa6bad2c2a785521a106.zip
RustAndDust-e518b17f855549d540d4aa6bad2c2a785521a106.tar.gz
OrderList: add dispose(Pawn, Order.OrderType)
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-rw-r--r--core/src/ch/asynk/tankontank/engine/OrderList.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/OrderList.java b/core/src/ch/asynk/tankontank/engine/OrderList.java
index 287f374..60b0545 100644
--- a/core/src/ch/asynk/tankontank/engine/OrderList.java
+++ b/core/src/ch/asynk/tankontank/engine/OrderList.java
@@ -17,6 +17,18 @@ public class OrderList extends LinkedList<Order>
}
}
+ public void dispose(Pawn pawn, Order.OrderType type)
+ {
+ Iterator<Order> it = iterator();
+ while(it.hasNext()) {
+ Order order = it.next();
+ if ((order.compareTo(pawn) == 0) && (order.isA(type))) {
+ it.remove();
+ order.dispose();
+ }
+ }
+ }
+
public void dispose()
{
for (Order o : this)