diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-05-10 14:06:48 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-05-10 14:06:48 +0200 |
commit | 758793c53e9fbb9701d2a9b62abc5adb4b67477e (patch) | |
tree | 58f0fbd2cbcbcc1ca92059c38fdcdbec0bb68163 /core/src/ch/asynk/rustanddust/game | |
parent | 7a583d4157bd91a0d088968edd438b055cf41c6b (diff) | |
download | RustAndDust-758793c53e9fbb9701d2a9b62abc5adb4b67477e.zip RustAndDust-758793c53e9fbb9701d2a9b62abc5adb4b67477e.tar.gz |
Battle: clean up map.clear() usage
Diffstat (limited to 'core/src/ch/asynk/rustanddust/game')
4 files changed, 10 insertions, 19 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Ctrl.java b/core/src/ch/asynk/rustanddust/game/Ctrl.java index 5aaada0..80bbd8f 100644 --- a/core/src/ch/asynk/rustanddust/game/Ctrl.java +++ b/core/src/ch/asynk/rustanddust/game/Ctrl.java @@ -232,7 +232,6 @@ public abstract class Ctrl implements Disposable game.db.storeGameState(gameId, battle.getTurnCount(), battle.getPlayer().id, unload(Marshal.Mode.PLAYERS), unload(Marshal.Mode.MAP)); game.db.clearGameOrders(gameId); game.db.storeTurnState(gameId); - map.clear(true); } private boolean loadTurn(int turn) @@ -241,7 +240,6 @@ public abstract class Ctrl implements Disposable if (r == null) return false; battle.turnDone(); - map.clear(true); load(Marshal.Mode.PLAYER, r.players); validateState(r); @@ -414,13 +412,10 @@ public abstract class Ctrl implements Disposable if (mode == Mode.LOADING) { this.mode = ((stateAfterAnimation == StateType.REPLAY) ? Mode.REPLAY : Mode.PLAY); - if (game.config.loadMode == Config.LoadMode.NEW) { - storeState(); - storeTurn(); - } if (mode == Mode.PLAY) - map.clear(true); + storeInitialState(); } + this.blockMap = false; StateType tmp = stateAfterAnimation; stateAfterAnimation = StateType.WAIT_EVENT; @@ -560,10 +555,7 @@ public abstract class Ctrl implements Disposable } } - storeState(); - storeTurn(); - map.clear(true); - clearOrders(); + storeNewGameTurn(); } private void abortAction() diff --git a/core/src/ch/asynk/rustanddust/game/Map.java b/core/src/ch/asynk/rustanddust/game/Map.java index 0c2edfa..0a38f2a 100644 --- a/core/src/ch/asynk/rustanddust/game/Map.java +++ b/core/src/ch/asynk/rustanddust/game/Map.java @@ -24,13 +24,10 @@ public abstract class Map extends Map5Marshal meteorology = new Meteorology(); } - public void clear() { clear(false); } - public void clear(boolean orders) + public void clear() { - if (orders) { - RustAndDust.debug(" Map", String.format("Clearder Orders : %d", ordersSize())); - ordersClear(); - } + RustAndDust.debug(" Map", String.format("Clearder Orders : %d", ordersSize())); + ordersClear(); clearMoves(); clearUnits(); } diff --git a/core/src/ch/asynk/rustanddust/game/states/StateReinforcement.java b/core/src/ch/asynk/rustanddust/game/states/StateReinforcement.java index ffb1f24..847b622 100644 --- a/core/src/ch/asynk/rustanddust/game/states/StateReinforcement.java +++ b/core/src/ch/asynk/rustanddust/game/states/StateReinforcement.java @@ -12,7 +12,8 @@ public class StateReinforcement extends StateCommon @Override public void enterFrom(StateType prevState) { - map.clear(); + map.clearMoves(); + map.clearUnits(); entryZone = null; activeUnit = null; selectedHex = null; diff --git a/core/src/ch/asynk/rustanddust/game/states/StateSelect.java b/core/src/ch/asynk/rustanddust/game/states/StateSelect.java index 8118e89..1f042e7 100644 --- a/core/src/ch/asynk/rustanddust/game/states/StateSelect.java +++ b/core/src/ch/asynk/rustanddust/game/states/StateSelect.java @@ -124,7 +124,8 @@ public class StateSelect extends StateCommon private void clear() { hide(); - map.clear(); + map.clearMoves(); + map.clearUnits(); to = null; isEnemy = false; selectedHex = null; |