summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/src/ch/asynk/rustanddust/game/Ctrl.java2
-rw-r--r--core/src/ch/asynk/rustanddust/game/ctrl/Solo.java7
-rw-r--r--core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java13
3 files changed, 4 insertions, 18 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Ctrl.java b/core/src/ch/asynk/rustanddust/game/Ctrl.java
index 2f88b43..0f608d6 100644
--- a/core/src/ch/asynk/rustanddust/game/Ctrl.java
+++ b/core/src/ch/asynk/rustanddust/game/Ctrl.java
@@ -439,7 +439,6 @@ public abstract class Ctrl implements Disposable
return;
}
nextState = null;
- map.clearMarshalUnits();
}
hud.notify("Replay Done", Position.MIDDLE_CENTER);
this.mode = Mode.PLAY;
@@ -584,6 +583,7 @@ public abstract class Ctrl implements Disposable
private void exitBattle()
{
if (debugCtrl) RustAndDust.debug(" EXIT BATTLE");
+ Unit.clear();
game.switchToMenu();
}
diff --git a/core/src/ch/asynk/rustanddust/game/ctrl/Solo.java b/core/src/ch/asynk/rustanddust/game/ctrl/Solo.java
index 19dd390..d41034f 100644
--- a/core/src/ch/asynk/rustanddust/game/ctrl/Solo.java
+++ b/core/src/ch/asynk/rustanddust/game/ctrl/Solo.java
@@ -45,13 +45,6 @@ public class Solo extends Ctrl
load(Marshal.Mode.MAP, r.map);
load(Marshal.Mode.PLAYERS, r.players);
load(Marshal.Mode.ORDERS, r.orders);
- switch (game.config.loadMode)
- {
- case REPLAY_BATTLE: break;
- default:
- battle.getMap().clearMarshalUnits();
- break;
- }
synched = r.synched;
r.dispose();
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;
}