summaryrefslogtreecommitdiffstats
path: root/core/src/ch
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-12-28 18:10:01 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-12-28 18:10:01 +0100
commitd76dd1fa80df0f89e33c3d3c5ab40e48c4f82d77 (patch)
tree97fa58b5148c6e1f6f68d61976651292abc8a73d /core/src/ch
parentfc04b08c9aca184f4cecb8444ae5e582094689f2 (diff)
downloadRustAndDust-d76dd1fa80df0f89e33c3d3c5ab40e48c4f82d77.zip
RustAndDust-d76dd1fa80df0f89e33c3d3c5ab40e48c4f82d77.tar.gz
OrderList: add get(Pawn, Order.OrderType)
Diffstat (limited to 'core/src/ch')
-rw-r--r--core/src/ch/asynk/rustanddust/engine/OrderList.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/OrderList.java b/core/src/ch/asynk/rustanddust/engine/OrderList.java
index 4488cfe..6fdd6e7 100644
--- a/core/src/ch/asynk/rustanddust/engine/OrderList.java
+++ b/core/src/ch/asynk/rustanddust/engine/OrderList.java
@@ -9,6 +9,17 @@ import com.badlogic.gdx.utils.JsonWriter.OutputType;
public class OrderList extends LinkedList<Order> implements Json.Serializable
{
+ public Order get(Pawn pawn, Order.OrderType type)
+ {
+ Iterator<Order> it = iterator();
+ while(it.hasNext()) {
+ Order order = it.next();
+ if ((order.compareTo(pawn) == 0) && (order.isA(type)))
+ return order;
+ }
+ return null;
+ }
+
public void dispose(Pawn pawn)
{
Iterator<Order> it = iterator();