summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-03-29 12:01:13 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2016-03-29 12:01:13 +0200
commit379c5aca8e138bbbbd1e530cf0ecf73c9d49a553 (patch)
treee585a4442cde122f90e570acd916036c6cca48ed
parentc1ae3706233bb2abff79e7b4c8673bb01539f26d (diff)
downloadRustAndDust-379c5aca8e138bbbbd1e530cf0ecf73c9d49a553.zip
RustAndDust-379c5aca8e138bbbbd1e530cf0ecf73c9d49a553.tar.gz
Ctrl: replay last order on resume if not synched
-rw-r--r--core/src/ch/asynk/rustanddust/game/Ctrl.java10
-rw-r--r--core/src/ch/asynk/rustanddust/game/ctrl/Solo.java1
2 files changed, 10 insertions, 1 deletions
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");