summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_subvault.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/l_subvault.cc')
-rw-r--r--crawl-ref/source/l_subvault.cc57
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 }
+};