summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_dgn.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2012-10-17 16:16:16 +0200
committerAdam Borowski <kilobyte@angband.pl>2012-10-17 16:16:16 +0200
commit5a75311d0f82bb786b3586f6fa01c784261a6dfd (patch)
tree018218c226c60226f876ba6fdf33d96dde0e1f03 /crawl-ref/source/l_dgn.cc
parent06c43eb0b206f629c289836fd719d444db9607a8 (diff)
downloadcrawl-ref-5a75311d0f82bb786b3586f6fa01c784261a6dfd.tar.gz
crawl-ref-5a75311d0f82bb786b3586f6fa01c784261a6dfd.zip
Revert "Remove dgn_resolve_map()."
Apparently, some Nethacker spy must have broken into my system and replaced the git-grep binary, rigged the terminal to insert a typo in the search, or do something else nasty! This reverts commit 840f2d079fa55bb7bf019d1b5736aaaadc41e864.
Diffstat (limited to 'crawl-ref/source/l_dgn.cc')
-rw-r--r--crawl-ref/source/l_dgn.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/crawl-ref/source/l_dgn.cc b/crawl-ref/source/l_dgn.cc
index 86b7a9bc9a..22fbb207eb 100644
--- a/crawl-ref/source/l_dgn.cc
+++ b/crawl-ref/source/l_dgn.cc
@@ -1696,6 +1696,36 @@ LUAFN(dgn_is_validating)
return 1;
}
+LUAFN(_dgn_resolve_map)
+{
+ if (lua_isnil(ls, 1))
+ {
+ lua_pushnil(ls);
+ return 1;
+ }
+
+ MAP(ls, 1, map);
+ const bool check_collisions = _lua_boolean(ls, 2, true);
+
+ // Save the vault_placement into Temp_Vaults because the map_def
+ // will need to be alive through to the end of dungeon gen.
+ Temp_Vaults.push_back(vault_placement());
+
+ vault_placement &place(Temp_Vaults[Temp_Vaults.size() - 1]);
+
+ if (vault_main(place, map, check_collisions) != MAP_NONE)
+ {
+ clua_push_map(ls, &place.map);
+ lua_pushlightuserdata(ls, &place);
+ }
+ else
+ {
+ lua_pushnil(ls);
+ lua_pushnil(ls);
+ }
+ return 2;
+}
+
LUAFN(_dgn_reuse_map)
{
if (!lua_isuserdata(ls, 1))
@@ -1851,6 +1881,7 @@ const struct luaL_reg dgn_dlib[] =
{ "map_by_place", dgn_map_by_place },
{ "place_map", _dgn_place_map },
{ "reuse_map", _dgn_reuse_map },
+{ "resolve_map", _dgn_resolve_map },
{ "in_vault", _dgn_in_vault },
{ "map_parameters", _dgn_map_parameters },