summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-03-31 15:09:41 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2016-03-31 15:09:41 +0200
commitc7aa832453cfe4d4bc54be6e0fb7f5ee91bfb87f (patch)
tree841064c1a7c3d8ad13dfc63bc85947f68d304319 /core
parent5029461112c81ced27efc94797d10968b5f93972 (diff)
downloadRustAndDust-c7aa832453cfe4d4bc54be6e0fb7f5ee91bfb87f.zip
RustAndDust-c7aa832453cfe4d4bc54be6e0fb7f5ee91bfb87f.tar.gz
PlayMenu: set game.config.battle on reload/replay
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/rustanddust/menu/PlayMenu.java17
1 files 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;