diff options
author | Jude Brown <bookofjude@users.sourceforge.net> | 2011-11-02 17:43:58 +1000 |
---|---|---|
committer | Jude Brown <bookofjude@users.sourceforge.net> | 2011-11-02 17:46:05 +1000 |
commit | f1eeef90454bc314b33c1683cdc0c0e67f1d6426 (patch) | |
tree | 869d1f751fe3e265bc70c70044b3e7c280296e91 /crawl-ref/source/l_file.cc | |
parent | 1cef3b35c2dafc17dd06a53429b4a8d3035a25f2 (diff) | |
download | crawl-ref-f1eeef90454bc314b33c1683cdc0c0e67f1d6426.tar.gz crawl-ref-f1eeef90454bc314b33c1683cdc0c0e67f1d6426.zip |
Fix broken fog machine loading (Elynae).
This now introduces the capacity to check the minor version of a save
file via file.minor_version(th). Unfortunately, the enum in
tag-version.h isn't accessible, so you have to go off the numeric
values.
This may introduce issues on updating the major version. Don't forget to
clear lm_fog.lua too!
May cause other bugs, but none I've noticed so far.
Diffstat (limited to 'crawl-ref/source/l_file.cc')
-rw-r--r-- | crawl-ref/source/l_file.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/crawl-ref/source/l_file.cc b/crawl-ref/source/l_file.cc index efa5f279b4..e5169c942d 100644 --- a/crawl-ref/source/l_file.cc +++ b/crawl-ref/source/l_file.cc @@ -41,6 +41,15 @@ static int file_marshall(lua_State *ls) return (0); } +static int file_minor_version(lua_State *ls) +{ + if (lua_gettop(ls) != 1) + luaL_error(ls, "Need reader as one argument"); + reader &th(*static_cast<reader*>(lua_touserdata(ls, 1))); + lua_pushnumber(ls, th.getMinorVersion()); + return (1); +} + static int file_unmarshall_boolean(lua_State *ls) { if (lua_gettop(ls) != 1) @@ -199,6 +208,7 @@ static const struct luaL_reg file_dlib[] = { "writefile", _file_writefile }, { "datadir_files", _file_datadir_files }, { "datadir_files_recursive", _file_datadir_files_recursive }, + { "minor_version", file_minor_version }, { NULL, NULL } }; |