From 379c5aca8e138bbbbd1e530cf0ecf73c9d49a553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 29 Mar 2016 12:01:13 +0200 Subject: Ctrl: replay last order on resume if not synched --- core/src/ch/asynk/rustanddust/game/Ctrl.java | 10 +++++++++- core/src/ch/asynk/rustanddust/game/ctrl/Solo.java | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/core/src/ch/asynk/rustanddust/game/Ctrl.java b/core/src/ch/asynk/rustanddust/game/Ctrl.java index 6b7b65d..e1f63b4 100644 --- a/core/src/ch/asynk/rustanddust/game/Ctrl.java +++ b/core/src/ch/asynk/rustanddust/game/Ctrl.java @@ -38,6 +38,7 @@ public abstract class Ctrl implements Disposable public boolean blockMap; public boolean blockHud; private Hex touchedHex; + protected boolean replayLastOrder; private final State selectState; private final State pathState; @@ -83,6 +84,7 @@ public abstract class Ctrl implements Disposable this.blockMap = false; this.blockHud = false; this.touchedHex = null; + this.replayLastOrder = false; this.selectState = new StateSelect(); this.pathState = new StateMove(); @@ -103,12 +105,18 @@ public abstract class Ctrl implements Disposable init(); StateCommon.set(game); hud.update(); - this.hud.notify(battle.toString(), 2, Position.MIDDLE_CENTER, false); this.state = selectState; this.stateType = StateType.DONE; setState(battle.getState()); + + if (replayLastOrder) { + map.prepareReplayLastAction(); + setState(StateType.REPLAY); + } else { + this.hud.notify(battle.toString(), 2, Position.MIDDLE_CENTER, false); + } } @Override diff --git a/core/src/ch/asynk/rustanddust/game/ctrl/Solo.java b/core/src/ch/asynk/rustanddust/game/ctrl/Solo.java index ec020a5..42d7008 100644 --- a/core/src/ch/asynk/rustanddust/game/ctrl/Solo.java +++ b/core/src/ch/asynk/rustanddust/game/ctrl/Solo.java @@ -31,6 +31,7 @@ public class Solo extends Ctrl load(Marshal.Mode.STATE, r.state); load(Marshal.Mode.ORDERS, r.orders); battle.getMap().clearMarshalUnits(); + replayLastOrder = !r.synched; r.dispose(); } else System.err.println("TODO : null GameRecord"); -- cgit v1.1-2-g2b99