summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/files.cc
diff options
context:
space:
mode:
authorMatthew Cline <zelgadis@sourceforge.net>2009-10-23 01:35:58 -0700
committerMatthew Cline <zelgadis@sourceforge.net>2009-10-23 01:35:58 -0700
commit31429d39b7b11228e4731085f5f58958ef467eff (patch)
tree8a6f6ae5ac6b4b7b3fa4d3e1956a64bdec83adf5 /crawl-ref/source/files.cc
parent4b41d9b5d515c32cd872e73fa91aaa702cc016c9 (diff)
downloadcrawl-ref-31429d39b7b11228e4731085f5f58958ef467eff.tar.gz
crawl-ref-31429d39b7b11228e4731085f5f58958ef467eff.zip
Removed 0.5 savefile minor versions, renumbered
Removed the savefile minor versions which were introducded in 0.5, since bumping the major version from 5 to 6 breaks compatibility with 0.5 savefiles. Renumbered the 0.6 minor versions to start with 0. This contains a hack to maintain compatibility with 0.6 savefiles before the renumbering, a hack which should be removed before 0.6 is released.
Diffstat (limited to 'crawl-ref/source/files.cc')
-rw-r--r--crawl-ref/source/files.cc32
1 files changed, 23 insertions, 9 deletions
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc
index 6e25f41248..1444025a33 100644
--- a/crawl-ref/source/files.cc
+++ b/crawl-ref/source/files.cc
@@ -1958,8 +1958,11 @@ bool apply_to_all_dungeons(bool (*applicator)())
return (success);
}
-static bool _get_and_validate_version(FILE *restoreFile, char &major, char &minor,
- std::string* reason)
+// XXX: Minor version renumbering hack.
+bool _minor_renumbering_correction = false;
+
+static bool _get_and_validate_version(FILE *restoreFile, char &major,
+ char &minor, std::string* reason)
{
std::string dummy;
if (reason == 0)
@@ -1985,17 +1988,28 @@ static bool _get_and_validate_version(FILE *restoreFile, char &major, char &mino
return (false);
}
- // NOTE: This is a hacky replacement for what should have been caught
- // by MAJOR_VERSION above. Once the next major version update happens
- // (preferably when saves break with 0.5 -> 0.6) this check will need
- // to be removed.
- if (minor < TAG_MINOR_RELIGION)
+ if (minor < 0)
{
- *reason = "Sorry, but 0.4.x save and bones files are incompatible "
- "with 0.5!";
+ *reason = make_stringf("Minor version %d is negative!",
+ minor);
return (false);
}
+ // XXX: Temporary hack to avoid breaking savefile compatibility because
+ // of simply renumbering the minor-versions. Should be removed before
+ // 0.6 is released. 16 is the minor version which was introduced when
+ // the major version was bumped from 5 to 6.
+ COMPILE_CHECK(TAG_MINOR_VERSION < 16, c1);
+ if (minor >= 16)
+ {
+ mprf(MSGCH_WARN,
+ "Savefile minor version being changed from %d to %d "
+ "because of renumbering of minor versions after removing "
+ "0.5 minor versions.", minor, minor - 16);
+ minor -= 16;
+ _minor_renumbering_correction = true;
+ }
+
if (minor > TAG_MINOR_VERSION)
{
*reason = make_stringf("Minor version mismatch: %d (want <= %d).",