summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mapdef.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-06-25 19:54:59 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-06-25 19:54:59 +0000
commit7ce53143a6ea781bb9bd2eb29995c6d160331328 (patch)
tree3a9aa283080572b5cc8fbb0eb9f30a8cdb55e465 /crawl-ref/source/mapdef.cc
parent648c698c072f989a8e351efbac07a0c9afb9b638 (diff)
downloadcrawl-ref-7ce53143a6ea781bb9bd2eb29995c6d160331328.tar.gz
crawl-ref-7ce53143a6ea781bb9bd2eb29995c6d160331328.zip
.des files can use a global Lua prelude (before maps are defined) that runs
at start of game, before any maps are loaded, and does not run in the context of any specific map. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1654 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mapdef.cc')
-rw-r--r--crawl-ref/source/mapdef.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index 5323c421a0..edae6afa9f 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -849,8 +849,8 @@ void map_def::write_full(FILE *outf)
cache_offset = ftell(outf);
writeShort(outf, 0x1eaf); // Level indicator.
writeString(outf, name);
- writeString(outf, prelude.lua_string(), LUA_CHUNK_MAX_SIZE);
- writeString(outf, main.lua_string(), LUA_CHUNK_MAX_SIZE);
+ prelude.write(outf);
+ main.write(outf);
}
void map_def::read_full(FILE *inf)
@@ -869,8 +869,8 @@ void map_def::read_full(FILE *inf)
"Please reload your game.",
file.c_str()).c_str());
- prelude.set_chunk(readString(inf, LUA_CHUNK_MAX_SIZE));
- main.set_chunk(readString(inf, LUA_CHUNK_MAX_SIZE));
+ prelude.read(inf);
+ main.read(inf);
}
void map_def::load()
@@ -899,7 +899,7 @@ void map_def::write_index(FILE *outf) const
writeString(outf, tags);
writeString(outf, place);
write_depth_ranges(outf);
- writeString(outf, prelude.lua_string(), LUA_CHUNK_MAX_SIZE);
+ prelude.write(outf);
}
void map_def::read_index(FILE *inf)
@@ -911,7 +911,7 @@ void map_def::read_index(FILE *inf)
tags = readString(inf);
place = readString(inf);
read_depth_ranges(inf);
- prelude.set_chunk(readString(inf, LUA_CHUNK_MAX_SIZE));
+ prelude.read(inf);
index_only = true;
}
@@ -940,7 +940,7 @@ void map_def::set_file(const std::string &s)
std::string map_def::run_lua(bool run_main)
{
dlua.callfn("dgn_set_map", "m", this);
- int err = prelude.load(&dlua);
+ int err = prelude.load(dlua);
if (err == -1000)
lua_pushnil(dlua);
else if (err)
@@ -950,7 +950,7 @@ std::string map_def::run_lua(bool run_main)
lua_pushnil(dlua);
else
{
- err = main.load(&dlua);
+ err = main.load(dlua);
if (err == -1000)
lua_pushnil(dlua);
else if (err)