From 3b79b0c218f196700014d5974e4321512e45ed87 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 7 Aug 2024 14:16:45 -0400 Subject: [PATCH] v2.5.0: adjusted loading order for old games in progress data --- .../shatteredpixeldungeon/Dungeon.java | 7 +------ .../shatteredpixeldungeon/GamesInProgress.java | 13 +++++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java index 35dd1a7e5..aeab6eede 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java @@ -594,13 +594,8 @@ public class Dungeon { return false; } - // 1/4 - // 3/4 * 1/3 = 3/12 = 1/4 - // 3/4 * 2/3 * 1/2 = 6/24 = 1/4 - // 1/4 - private static final String INIT_VER = "init_ver"; - private static final String VERSION = "version"; + public static final String VERSION = "version"; private static final String SEED = "seed"; private static final String CUSTOM_SEED = "custom_seed"; private static final String DAILY = "daily"; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/GamesInProgress.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/GamesInProgress.java index 465c7ff99..f0a4cb0aa 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/GamesInProgress.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/GamesInProgress.java @@ -103,13 +103,14 @@ public class GamesInProgress { try { Bundle bundle = FileUtils.bundleFromFile(gameFile(slot)); - info = new Info(); - info.slot = slot; - Dungeon.preview(info, bundle); - - //saves from before v1.4.3 are not supported - if (info.version < ShatteredPixelDungeon.v1_4_3) { + + if (bundle.getInt( "version" ) < ShatteredPixelDungeon.v1_4_3) { info = null; + } else { + + info = new Info(); + info.slot = slot; + Dungeon.preview(info, bundle); } } catch (IOException e) {