From 31429d39b7b11228e4731085f5f58958ef467eff Mon Sep 17 00:00:00 2001 From: Matthew Cline Date: Fri, 23 Oct 2009 01:35:58 -0700 Subject: 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. --- crawl-ref/source/files.cc | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'crawl-ref/source/files.cc') 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).", -- cgit v1.2.3-54-g00ecf