summaryrefslogtreecommitdiff
path: root/src/saveload/saveload.h
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2020-12-22 10:44:07 +0100
committerGitHub <noreply@github.com>2020-12-22 10:44:07 +0100
commitd8c8f4e72d8a8f9306bc4e6a86c012dee740c8ca (patch)
tree6a10a3b5374b3e085f5b084d5ae467acd3e9467d /src/saveload/saveload.h
parent6c3a5b5b17de97be292fc9442f6bd693973114ee (diff)
downloadopenttd-d8c8f4e72d8a8f9306bc4e6a86c012dee740c8ca.tar.xz
Fix: next 67 savegame versions are used in PatchPacks; skip them (#8411)
Various of PatchPacks (Spring 2013, Joker, ChillPP) used versions slightly higher than ours. Of course, as time went by, this caught up with us, and we are now almost pushing a new version that would conflict with them. To avoid users creating unneeded issues about "why can I not load my savegame", lets be ahead of the curve and flat-out refuse to load them. Version-wise, this is totally fine. We have ~32k versions to go before we run out (0x8000 is masked by JGRPP; we should avoid using that). At the rate we bump savegames, this is not going to happen in any sane reality.
Diffstat (limited to 'src/saveload/saveload.h')
-rw-r--r--src/saveload/saveload.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h
index 3581a5594..7fa91a509 100644
--- a/src/saveload/saveload.h
+++ b/src/saveload/saveload.h
@@ -304,6 +304,22 @@ enum SaveLoadVersion : uint16 {
SLV_ENDING_YEAR, ///< 218 PR#7747 v1.10 Configurable ending year.
SLV_REMOVE_TOWN_CARGO_CACHE, ///< 219 PR#8258 Remove town cargo acceptance and production caches.
+ /* Patchpacks for a while considered it a good idea to jump a few versions
+ * above our version for their savegames. But as time continued, this gap
+ * has been closing, up to the point we would start to reuse versions from
+ * their patchpacks. This is not a problem from our perspective: the
+ * savegame will simply fail to load because they all contain chunks we
+ * cannot digest. But, this gives for ugly errors. As we have plenty of
+ * versions anyway, we simply skip the versions we know belong to
+ * patchpacks. This way we can present the user with a clean error
+ * indicate he is loading a savegame from a patchpack.
+ * For future patchpack creators: please follow a system like JGRPP, where
+ * the version is masked with 0x8000, and the true version is stored in
+ * its own chunk with feature toggles.
+ */
+ SLV_START_PATCHPACKS, ///< 220 First known patchpack to use a version just above ours.
+ SLV_END_PATCHPACKS = 286, ///< 286 Last known patchpack to use a version just above ours.
+
SL_MAX_VERSION, ///< Highest possible saveload version
};