summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mapdef.h
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-06-26 16:57:36 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-06-26 16:57:36 +0000
commit9d1463d7bdca2b485c5f8caa9b86782f29e30f8c (patch)
treedeeaa2d0b2a05d8ba346b941e9d47fcc3e40e95d /crawl-ref/source/mapdef.h
parent5f2f20b49792c771ebd67442042f97344e2a6a56 (diff)
downloadcrawl-ref-9d1463d7bdca2b485c5f8caa9b86782f29e30f8c.tar.gz
crawl-ref-9d1463d7bdca2b485c5f8caa9b86782f29e30f8c.zip
Added support for a validation hook for maps to check if they're A-Ok.
Tweaked savefile format (breaks saves) to allow the game to perform emergency saves if level-generation fails (followers are lost, needs to be fixed). [1743698] Re-refixed SP_ELF stub (Eino). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1659 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mapdef.h')
-rw-r--r--crawl-ref/source/mapdef.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/crawl-ref/source/mapdef.h b/crawl-ref/source/mapdef.h
index 8e1db25209..307b9bfd3e 100644
--- a/crawl-ref/source/mapdef.h
+++ b/crawl-ref/source/mapdef.h
@@ -394,6 +394,13 @@ typedef std::map<int, keyed_mapspec> keyed_specs;
typedef std::vector<level_range> depth_ranges;
+class map_def;
+struct dlua_set_map
+{
+ dlua_set_map(map_def *map);
+ ~dlua_set_map();
+};
+
class map_def
{
public:
@@ -411,7 +418,7 @@ public:
keyed_specs keyspecs;
- dlua_chunk prelude, main;
+ dlua_chunk prelude, main, validate, veto;
private:
// This map has been loaded from an index, and not fully realised.
@@ -435,7 +442,13 @@ public:
void set_file(const std::string &s);
std::string run_lua(bool skip_main);
- std::string validate();
+ // Returns true if the validation passed.
+ bool test_lua_validate();
+
+ // Returns true if *not* vetoed, i.e., the map is good to go.
+ bool test_lua_veto();
+
+ std::string validate_map_def();
void add_prelude_line(int line, const std::string &s);
void add_main_line(int line, const std::string &s);
@@ -476,6 +489,7 @@ public:
private:
void write_depth_ranges(FILE *) const;
void read_depth_ranges(FILE *);
+ bool test_lua_boolchunk(dlua_chunk &);
std::string rewrite_chunk_errors(const std::string &s) const;
std::string add_key_field(