From c7aa832453cfe4d4bc54be6e0fb7f5ee91bfb87f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 31 Mar 2016 15:09:41 +0200 Subject: PlayMenu: set game.config.battle on reload/replay --- core/src/ch/asynk/rustanddust/menu/PlayMenu.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/core/src/ch/asynk/rustanddust/menu/PlayMenu.java b/core/src/ch/asynk/rustanddust/menu/PlayMenu.java index 1f5735f..78fbe85 100644 --- a/core/src/ch/asynk/rustanddust/menu/PlayMenu.java +++ b/core/src/ch/asynk/rustanddust/menu/PlayMenu.java @@ -142,15 +142,11 @@ public class PlayMenu extends Patch implements MenuCtrl.Panel return MenuCtrl.MenuType.OKKO; } else if (resumeBtn.hit(x, y)) { game.playType(); - game.config.gameId = GameRecord.get(getList().getIdx()).id; - game.config.loadMode = Config.LoadMode.LOAD; - return MenuCtrl.MenuType.BEGIN; + return setConfig(Config.LoadMode.LOAD); } else if (replayBtn.hit(x, y)) { game.playType(); - game.config.gameId = GameRecord.get(getList().getIdx()).id; // TODO chose between : REPLAY_LAST / REPLAY_ALL - game.config.loadMode = Config.LoadMode.REPLAY_LAST; - return MenuCtrl.MenuType.BEGIN; + return setConfig(Config.LoadMode.REPLAY_LAST); } else if (list.hit(x, y)) { if (i != getList().getIdx()) game.playType(); @@ -161,6 +157,15 @@ public class PlayMenu extends Patch implements MenuCtrl.Panel return MenuCtrl.MenuType.NONE; } + private MenuCtrl.MenuType setConfig(Config.LoadMode loadMode) + { + GameRecord g = GameRecord.get(getList().getIdx()); + game.config.gameId = g.id; + game.config.battle = game.factory.getBattle(g.battle); + game.config.loadMode = loadMode; + return MenuCtrl.MenuType.BEGIN; + } + private void showBtns(boolean show) { deleteBtn.visible = show; -- cgit v1.1-2-g2b99