diff options
author | Enne Walker <ennewalker@users.sourceforge.net> | 2009-11-28 18:06:49 -0500 |
---|---|---|
committer | Enne Walker <ennewalker@users.sourceforge.net> | 2009-11-28 20:53:42 -0500 |
commit | 4fe67e14cab6affd2a69a864dda356440d50e0ca (patch) | |
tree | 47da4f5b30a1534a818aedfd7ea92ea0995268ca /crawl-ref/source/l_subvault.cc | |
parent | 13d037ff0e1c6394157ab5ccf5593458a167447a (diff) | |
download | crawl-ref-4fe67e14cab6affd2a69a864dda356440d50e0ca.tar.gz crawl-ref-4fe67e14cab6affd2a69a864dda356440d50e0ca.zip |
Subvaults.
Vaults can now include other vaults as a part of their definition. These
subvaults are currently included by tag only and replace glyphs in their
parent vault. See documentation for more details.
Vault:8 has been modified to use subvaults.
Diffstat (limited to 'crawl-ref/source/l_subvault.cc')
-rw-r--r-- | crawl-ref/source/l_subvault.cc | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/crawl-ref/source/l_subvault.cc b/crawl-ref/source/l_subvault.cc new file mode 100644 index 0000000000..f15963b222 --- /dev/null +++ b/crawl-ref/source/l_subvault.cc @@ -0,0 +1,57 @@ +/* + * File: l_subvault.cc + * Summary: Subvault routines (library "dgn"). + */ + +#include "AppHdr.h" + +#include "coord.h" +#include "cluautil.h" +#include "l_libs.h" +#include "mapdef.h" + +static int dgn_is_subvault(lua_State *ls) +{ + MAP(ls, 1, map); + + lua_pushboolean(ls, map->is_subvault()); + return (1); +} + +static int dgn_default_subvault_glyphs(lua_State *ls) +{ + MAP(ls, 1, map); + + map->apply_subvault_mask(); + return (0); +} + +static int dgn_subvault_cell_valid(lua_State *ls) +{ + MAP(ls, 1, map); + coord_def c; + c.x = luaL_checkint(ls, 2); + c.y = luaL_checkint(ls, 3); + + lua_pushboolean(ls, map->subvault_cell_valid(c)); + return (1); +} + +static int dgn_subvault_size(lua_State *ls) +{ + MAP(ls, 1, map); + + lua_pushnumber(ls, map->subvault_width()); + lua_pushnumber(ls, map->subvault_height()); + return (2); +} + +const struct luaL_reg dgn_subvault_dlib[] = +{ +{ "is_subvault", dgn_is_subvault }, +{ "default_subvault_glyphs", dgn_default_subvault_glyphs }, +{ "subvault_cell_valid", dgn_subvault_cell_valid }, +{ "subvault_size", dgn_subvault_size }, + +{ NULL, NULL } +}; |