diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-01-10 22:16:45 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-01-10 22:16:45 +0100 |
commit | fb3533a5da51e30bc3d18a22a79f807dd45261da (patch) | |
tree | 90758755d20d35abc8b109c3b4351b5c1f02daa9 /core/src/ch/asynk/rustanddust/engine | |
parent | 62c2956bf688f9d7ae7b00070828becb7822350f (diff) | |
download | RustAndDust-fb3533a5da51e30bc3d18a22a79f807dd45261da.zip RustAndDust-fb3533a5da51e30bc3d18a22a79f807dd45261da.tar.gz |
OrderList is an ArrayListIt
Diffstat (limited to 'core/src/ch/asynk/rustanddust/engine')
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/OrderList.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/OrderList.java b/core/src/ch/asynk/rustanddust/engine/OrderList.java index 588e90f..92a85ea 100644 --- a/core/src/ch/asynk/rustanddust/engine/OrderList.java +++ b/core/src/ch/asynk/rustanddust/engine/OrderList.java @@ -1,21 +1,25 @@ package ch.asynk.rustanddust.engine; -import java.util.LinkedList; import java.util.Iterator; import com.badlogic.gdx.utils.Json; import com.badlogic.gdx.utils.JsonValue; import com.badlogic.gdx.utils.JsonWriter.OutputType; -public class OrderList extends LinkedList<Order> implements Json.Serializable +import ch.asynk.rustanddust.engine.util.ArrayListIt; + +public class OrderList extends ArrayListIt<Order> implements Json.Serializable { + public OrderList(int capacity) + { + super(capacity); + } + 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; + for (Order o : this) { + if ((o.compareTo(pawn) == 0) && (o.isA(type))) + return o; } return null; } |