From c3d2986b22a8f2f1f5afa3567eca9d6b75c9f27a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 29 Mar 2016 19:15:01 +0200 Subject: Solo: use game.config.loadMode to load json --- core/src/ch/asynk/rustanddust/game/ctrl/Solo.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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() { -- cgit v1.1-2-g2b99