summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r--core/src/ch/asynk/rustanddust/engine/OrderList.java18
-rw-r--r--core/src/ch/asynk/rustanddust/game/map/Map4Commands.java2
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