summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/util/levcomp.ypp
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/util/levcomp.ypp
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/util/levcomp.ypp')
-rw-r--r--crawl-ref/source/util/levcomp.ypp28
1 files changed, 26 insertions, 2 deletions
diff --git a/crawl-ref/source/util/levcomp.ypp b/crawl-ref/source/util/levcomp.ypp
index 0a3cb8ada1..aec084fb22 100644
--- a/crawl-ref/source/util/levcomp.ypp
+++ b/crawl-ref/source/util/levcomp.ypp
@@ -65,7 +65,7 @@ level_range set_range(const char *s, int start, int end)
%token <i> BRANCHDEF BRANCH DESC DEFAULT
%token <i> DEFAULT_DEPTH SHUFFLE SUBST TAGS KFEAT KITEM KMONS
%token <i> NAME DEPTH ORIENT PLACE CHANCE MONS ITEM
-%token <i> PRELUDE MAIN
+%token <i> PRELUDE MAIN VALIDATE VETO
%token <i> CHARACTER
@@ -114,7 +114,7 @@ level : name map_specs
yyerror( lc_global_prelude.orig_error().c_str() );
}
- std::string err = lc_map.validate();
+ std::string err = lc_map.validate_map_def();
if (!err.empty())
yyerror(err.c_str());
if (!lc_map.has_depth() && !lc_default_depths.empty())
@@ -172,6 +172,8 @@ metaline : place
| kmons
| main_lua
| prelude_lua
+ | validate_lua
+ | veto_lua
;
global_lua : MAIN global_lua_lines { }
@@ -196,6 +198,28 @@ main_lua_line : LUA_LINE
lc_map.main.add(yylineno, $1);
}
+validate_lua : VALIDATE validate_lua_lines { }
+
+validate_lua_lines : /* empty */ { }
+ | validate_lua_lines validate_lua_line { }
+ ;
+
+validate_lua_line : LUA_LINE
+ {
+ lc_map.validate.add(yylineno, $1);
+ }
+
+veto_lua : VETO veto_lua_lines { }
+
+veto_lua_lines : /* empty */ { }
+ | veto_lua_lines veto_lua_line { }
+ ;
+
+veto_lua_line : LUA_LINE
+ {
+ lc_map.veto.add(yylineno, $1);
+ }
+
prelude_lua : PRELUDE prelude_lua_lines { }
prelude_lua_lines : /* empty */ { }