diff options
author | Jude Brown <bookofjude@users.sourceforge.net> | 2011-11-11 14:29:36 +1000 |
---|---|---|
committer | Jude Brown <bookofjude@users.sourceforge.net> | 2011-11-11 14:35:24 +1000 |
commit | c01bc6c7be0f1772ea008a143f14bea03f395520 (patch) | |
tree | 367a95e8fe9452cf1716435f1dd36171a382a767 | |
parent | 9c67fedf4c0225c80be15bd7cfa49fbd94ba0eae (diff) | |
download | crawl-ref-c01bc6c7be0f1772ea008a143f14bea03f395520.tar.gz crawl-ref-c01bc6c7be0f1772ea008a143f14bea03f395520.zip |
Update marker save compatibility, wrapper for TAG_MAJOR_VERSION.
-rw-r--r-- | crawl-ref/docs/develop/save_compatibility.txt | 27 | ||||
-rw-r--r-- | crawl-ref/source/l_file.cc | 7 |
2 files changed, 34 insertions, 0 deletions
diff --git a/crawl-ref/docs/develop/save_compatibility.txt b/crawl-ref/docs/develop/save_compatibility.txt index c2f976632b..e9a69ec35e 100644 --- a/crawl-ref/docs/develop/save_compatibility.txt +++ b/crawl-ref/docs/develop/save_compatibility.txt @@ -134,3 +134,30 @@ on, we should add placeholder tiles before the official release, that can later be replaced without affecting saved games. Johanna + + +A few comments on map caches and Lua markers +-------------------------------------------- +Map and vault definitions are read from the relevant .des files and are stored +in a binary format to prevent slow-down every time crawl starts. If new +attributes or properties are added to vault definitions, save-compatibility +needs to be ensured in much the same way as for normal saves. Until recently, +the .des cache used a different version number to the main major/minor system. +In theory, all that needs to be done now is to bump the minor version, which +will cause the being-loaded .des cache file to be considered invalid, and thus +rebuilt. + +When modifying a Lua marker, specifically when adding new options, etc, you'll +need to likewise ensure save compatibility. The minor version is currently +accessible by calling file.minor_version(reader). This will return a numeric +value that has to be manually compared to the relevant minor tag. + +The current major version of the software is accessible by calling +file.major_version(). There's no need to pass the reader in, as if the major +version of a file mis-matches, the game won't attempt to load it, and you will +never get to a stage of being able to look for it. + +All Lua markers will need to be checked for minor-version checks when updating +the major version. + +due diff --git a/crawl-ref/source/l_file.cc b/crawl-ref/source/l_file.cc index e5169c942d..dbb73b7ab8 100644 --- a/crawl-ref/source/l_file.cc +++ b/crawl-ref/source/l_file.cc @@ -50,6 +50,12 @@ static int file_minor_version(lua_State *ls) return (1); } +static int file_major_version(lua_State *ls) +{ + lua_pushnumber(ls, TAG_MAJOR_VERSION); + return (1); +} + static int file_unmarshall_boolean(lua_State *ls) { if (lua_gettop(ls) != 1) @@ -209,6 +215,7 @@ static const struct luaL_reg file_dlib[] = { "datadir_files", _file_datadir_files }, { "datadir_files_recursive", _file_datadir_files_recursive }, { "minor_version", file_minor_version }, + { "major_version", file_major_version }, { NULL, NULL } }; |