summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/rustanddust
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-03-29 19:15:01 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2016-03-29 19:15:01 +0200
commitc3d2986b22a8f2f1f5afa3567eca9d6b75c9f27a (patch)
tree3070143c84cacdcc8f84de406a18947dd26642f2 /core/src/ch/asynk/rustanddust
parentb1fe80f29c7f8c28802a7e2d1c4aaf9582a0e46f (diff)
downloadRustAndDust-c3d2986b22a8f2f1f5afa3567eca9d6b75c9f27a.zip
RustAndDust-c3d2986b22a8f2f1f5afa3567eca9d6b75c9f27a.tar.gz
Solo: use game.config.loadMode to load json
Diffstat (limited to 'core/src/ch/asynk/rustanddust')
-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()
{