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 | |
parent | 62c2956bf688f9d7ae7b00070828becb7822350f (diff) | |
download | RustAndDust-fb3533a5da51e30bc3d18a22a79f807dd45261da.zip RustAndDust-fb3533a5da51e30bc3d18a22a79f807dd45261da.tar.gz |
OrderList is an ArrayListIt
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/OrderList.java | 18 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/map/Map4Commands.java | 2 |
2 files changed, 12 insertions, 8 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; } diff --git a/core/src/ch/asynk/rustanddust/game/map/Map4Commands.java b/core/src/ch/asynk/rustanddust/game/map/Map4Commands.java index 8cde4fc..2335475 100644 --- a/core/src/ch/asynk/rustanddust/game/map/Map4Commands.java +++ b/core/src/ch/asynk/rustanddust/game/map/Map4Commands.java @@ -27,7 +27,7 @@ public abstract class Map4Commands extends Map3Animations super(game, map, hex); this.battle = game.ctrl.battle; - this.commands = new OrderList(); + this.commands = new OrderList(10); } @Override |