summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/rustanddust/game/map
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-05-11 14:47:28 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2016-05-11 14:47:28 +0200
commit79cc37d1dd46569f3c5e5a3cef0727494d6b24c6 (patch)
tree654e89359a35cbbb32ac317d64fb2684abfbec19 /core/src/ch/asynk/rustanddust/game/map
parenta5cef081cee24e162d18d48ff798612f4dafbbd5 (diff)
downloadRustAndDust-79cc37d1dd46569f3c5e5a3cef0727494d6b24c6.zip
RustAndDust-79cc37d1dd46569f3c5e5a3cef0727494d6b24c6.tar.gz
Map5Marshal,Ctrl: use Unit.IterableSet<Unit>, call Unit.clear() at exit
Diffstat (limited to 'core/src/ch/asynk/rustanddust/game/map')
-rw-r--r--core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java13
1 files changed, 3 insertions, 10 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java b/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java
index dc7554f..fed1840 100644
--- a/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java
+++ b/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java
@@ -25,10 +25,6 @@ import ch.asynk.rustanddust.game.Engagement;
public abstract class Map5Marshal extends Map4Orders implements Marshal
{
- private static UnitList units = new UnitList(30);
-
- public void clearMarshalUnits() { units.clear(); }
-
public Map5Marshal(final RustAndDust game, Texture map, SelectedTile hex)
{
super(game, map, hex);
@@ -273,7 +269,6 @@ public abstract class Map5Marshal extends Map4Orders implements Marshal
public void loadPlayers(JsonValue v, Player[] players)
{
- clearMarshalUnits();
Unit.blockId = true;
players[0] = loadPlayer(v.get("players").get(0));
players[1] = loadPlayer(v.get("players").get(1));
@@ -331,7 +326,6 @@ public abstract class Map5Marshal extends Map4Orders implements Marshal
Hex h = getHex(a.getInt(0), a.getInt(1));
setOnBoard(u, h, Orientation.fromRotation(a.getInt(2)));
}
- units.add(u);
return u;
}
@@ -474,10 +468,9 @@ public abstract class Map5Marshal extends Map4Orders implements Marshal
private static Unit findById(int id)
{
- for (Unit u : units) {
- if (u.id() == id)
- return u;
- }
+ Unit u = Unit.findById(id);
+ if (u != null)
+ return u;
RustAndDust.error(String.format("findById: unable to find unit %d", id));
return null;
}