diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-03-22 15:09:40 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-03-22 15:09:40 +0100 |
commit | 1a1bddf6bf5de71604771ccf7a11ddab4ab7ceb5 (patch) | |
tree | b1b0f6377432542b3392d524eb735a0d99adad42 /core/src/ch/asynk/rustanddust/game/ctrl | |
parent | 72583e54cb3823e2d86f0d80d7cc587f102e62ec (diff) | |
download | RustAndDust-1a1bddf6bf5de71604771ccf7a11ddab4ab7ceb5.zip RustAndDust-1a1bddf6bf5de71604771ccf7a11ddab4ab7ceb5.tar.gz |
SQL: schema rewrite
Diffstat (limited to 'core/src/ch/asynk/rustanddust/game/ctrl')
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/ctrl/Solo.java | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/ctrl/Solo.java b/core/src/ch/asynk/rustanddust/game/ctrl/Solo.java index 77bcc23..d7cda5c 100644 --- a/core/src/ch/asynk/rustanddust/game/ctrl/Solo.java +++ b/core/src/ch/asynk/rustanddust/game/ctrl/Solo.java @@ -27,37 +27,50 @@ public class Solo extends Ctrl battle.initialDeployment(); } else { GameRecord r = game.db.loadGame(gameId); - battle.load(Marshal.Mode.FULL, r.turn, r.payload); - r.dispose(); + if (r != null) { + battle.load(Marshal.Mode.STATE, r.turn, r.state); + battle.load(Marshal.Mode.ORDERS, r.turn, r.orders); + battle.getMap().clearMarshalUnits(); + r.dispose(); + } else + System.err.println("TODO : null GameRecord"); } } @Override public void orderProcessedCb() { - // TODO + // FIXME what about multible orders actions, HQ actiovations + if (!isLoading()) + storeOrders(); } @Override protected void actionDoneCb() { - storeGame(); + storeState(); } @Override protected void turnDoneCb() { - storeGame(); + storeState(); + storeOrders(); storeTurn(); } - private void storeGame() + private void storeState() { - game.db.storeGame(gameId, battle.getTurnCount(), battle.getPlayer().id, battle.unload(Marshal.Mode.FULL)); + game.db.storeGameState(gameId, battle.getTurnCount(), battle.getPlayer().id, battle.unload(Marshal.Mode.STATE)); + } + + private void storeOrders() + { + game.db.storeGameOrders(gameId, battle.getTurnCount(), battle.getPlayer().id, battle.unload(Marshal.Mode.ORDERS)); } private void storeTurn() { - game.db.storeTurn(gameId); + game.db.storeLastTurn(gameId); } } |