From e92999f1200f022ac4b031dbf258de7e1e450bb4 Mon Sep 17 00:00:00 2001 From: ennewalker Date: Mon, 5 Jan 2009 01:26:53 +0000 Subject: Adding SVN revision number (and build date) into .sav files. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8220 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/tags.cc | 28 +++++++++++++++++++++++++--- crawl-ref/source/tags.h | 6 +++++- 2 files changed, 30 insertions(+), 4 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc index 4076537e15..d058d2e782 100644 --- a/crawl-ref/source/tags.cc +++ b/crawl-ref/source/tags.cc @@ -1032,17 +1032,30 @@ static void tag_construct_you(writer &th) for (unsigned int k = 0; k < you.mesmerised_by.size(); k++) marshallByte(th, you.mesmerised_by[k]); - // minorVersion 2 starts here + // minorVersion TAG_MINOR_PIETY starts here marshallByte(th, you.piety_hysteresis); - // minorVersion 3 starts here + // minorVersion TAG_MINOR_QUIVER starts here you.m_quiver->save(th); - // minorVersion 7 starts here + // minorVersion TAG_MINOR_FPICKUP starts here marshallByte(th, you.friendly_pickup); + // minorVersion TAG_MINOR_LUADGN starts here if (!dlua.callfn("dgn_save_data", "u", &th)) mprf(MSGCH_ERROR, "Failed to save Lua data: %s", dlua.error.c_str()); + + // minorVersion TAG_MINOR_SVNREV starts here + // Write a human-readable string out on the off chance that + // we fail to be able to read this file back in using some later version. + std::string revision = "SVN:"; + revision += number_to_string(svn_revision()); + revision += ":"; + revision += VERSION_DETAIL; + marshallString(th, revision); + marshallLong(th, svn_revision()); + + printf("REVSAVE: (%s), (%d)\n", revision.c_str(), svn_revision()); } static void tag_construct_you_items(writer &th) @@ -1459,6 +1472,15 @@ static void tag_read_you(reader &th, char minorVersion) mprf(MSGCH_ERROR, "Failed to load Lua persist table: %s", dlua.error.c_str()); } + + if (minorVersion >= TAG_MINOR_SVNREV) + { + std::string rev_str = unmarshallString(th); + int rev_int = unmarshallLong(th); + + UNUSED(rev_str); + UNUSED(rev_int); + } } static void tag_read_you_items(reader &th, char minorVersion) diff --git a/crawl-ref/source/tags.h b/crawl-ref/source/tags.h index 22e8489a9f..73d3103013 100644 --- a/crawl-ref/source/tags.h +++ b/crawl-ref/source/tags.h @@ -45,6 +45,8 @@ enum tag_major_version }; // Minor version will be reset to zero when major version changes. +// Tags are checked with >=, so a minor version of 11 would logically include +// the dungeon Lua changes. enum tag_minor_version { TAG_MINOR_PIETY = 2, // Added piety_hysteresis @@ -57,7 +59,9 @@ enum tag_minor_version TAG_MINOR_PATHFIND = 9, // Added monster pathfinding. TAG_MINOR_TRTARGET = 10, // Added travel target. TAG_MINOR_LUADGN = 11, // Allow dungeon Lua to persist data. - TAG_MINOR_VERSION // Current version + // Bump version past 12. + TAG_MINOR_SVNREV = 13, // Added SVN revision + TAG_MINOR_VERSION = 13 // Current version. (Keep equal to max.) }; -- cgit v1.2.3-54-g00ecf