summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/rustanddust/game/ctrl/Solo.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/ctrl/Solo.java b/core/src/ch/asynk/rustanddust/game/ctrl/Solo.java
index c9de875..54d2310 100644
--- a/core/src/ch/asynk/rustanddust/game/ctrl/Solo.java
+++ b/core/src/ch/asynk/rustanddust/game/ctrl/Solo.java
@@ -27,7 +27,7 @@ public class Solo extends Ctrl
battle.initialDeployment();
synched = true;
} else {
- GameRecord r = game.db.loadGame(gameId);
+ GameRecord r = loadState();
if (r != null) {
load(Marshal.Mode.STATE, r.state);
load(Marshal.Mode.ORDERS, r.orders);
@@ -39,6 +39,23 @@ public class Solo extends Ctrl
}
}
+ private GameRecord loadState()
+ {
+ GameRecord r = null;
+ switch (game.config.loadMode) {
+ case LOAD:
+ r = game.db.loadGame(gameId);
+ break;
+ case REPLAY_LAST:
+ r = game.db.loadLastTurn(gameId);
+ break;
+ case REPLAY_ALL:
+ // TODO REPLAY_ALL
+ break;
+ }
+ return r;
+ }
+
@Override
public void orderProcessedCb()
{