diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-28 18:10:01 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-28 18:10:01 +0100 |
commit | d76dd1fa80df0f89e33c3d3c5ab40e48c4f82d77 (patch) | |
tree | 97fa58b5148c6e1f6f68d61976651292abc8a73d /core/src | |
parent | fc04b08c9aca184f4cecb8444ae5e582094689f2 (diff) | |
download | RustAndDust-d76dd1fa80df0f89e33c3d3c5ab40e48c4f82d77.zip RustAndDust-d76dd1fa80df0f89e33c3d3c5ab40e48c4f82d77.tar.gz |
OrderList: add get(Pawn, Order.OrderType)
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/OrderList.java | 11 |
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(); |