From e518b17f855549d540d4aa6bad2c2a785521a106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 19 Feb 2015 00:22:07 +0100 Subject: OrderList: add dispose(Pawn, Order.OrderType) --- core/src/ch/asynk/tankontank/engine/OrderList.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 } } + public void dispose(Pawn pawn, Order.OrderType type) + { + Iterator 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) -- cgit v1.1-2-g2b99