summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/dlua.cc5
-rw-r--r--crawl-ref/source/dlua.h7
-rw-r--r--crawl-ref/source/l_dgn.cc332
-rw-r--r--crawl-ref/source/l_dgnit.cc97
-rw-r--r--crawl-ref/source/l_dgnmon.cc267
-rw-r--r--crawl-ref/source/l_libs.h10
-rw-r--r--crawl-ref/source/makefile.obj4
7 files changed, 387 insertions, 335 deletions
diff --git a/crawl-ref/source/dlua.cc b/crawl-ref/source/dlua.cc
index 0775c2635d..a14b88937e 100644
--- a/crawl-ref/source/dlua.cc
+++ b/crawl-ref/source/dlua.cc
@@ -308,6 +308,8 @@ void init_dungeon_lua()
luaL_openlib(dlua, "dgn", dgn_lib, 0);
luaL_openlib(dlua, "dgn", dgn_event_lib, 0);
+ luaL_openlib(dlua, "dgn", dgn_item_lib, 0);
+ luaL_openlib(dlua, "dgn", dgn_mons_lib, 0);
// Add additional function to the Crawl module.
luaL_openlib(dlua, "crawl", crawl_lib, 0);
luaL_openlib(dlua, "file", file_lib, 0);
@@ -327,7 +329,8 @@ void init_dungeon_lua()
register_builder_funcs(dlua);
- register_mapdef_tables(dlua);
+ register_itemlist(dlua);
+ register_monslist(dlua);
}
// Can be called from within a debugger to look at the current Lua
diff --git a/crawl-ref/source/dlua.h b/crawl-ref/source/dlua.h
index e23fa220b7..ebb90398f8 100644
--- a/crawl-ref/source/dlua.h
+++ b/crawl-ref/source/dlua.h
@@ -87,6 +87,13 @@ inline void dlua_push_userdata(lua_State *ls, T udata, const char *meta)
*de = udata;
}
+template <class T>
+static void dlua_push_object_type(lua_State *ls, const char *meta, const T &data)
+{
+ T **ptr = clua_new_userdata<T*>(ls, meta);
+ *ptr = new T(data);
+}
+
void print_dlua_stack();
diff --git a/crawl-ref/source/l_dgn.cc b/crawl-ref/source/l_dgn.cc
index 1ec9f78050..e7792fe32f 100644
--- a/crawl-ref/source/l_dgn.cc
+++ b/crawl-ref/source/l_dgn.cc
@@ -9,83 +9,13 @@
#include "chardump.h"
#include "cloud.h"
#include "initfile.h"
-#include "items.h"
#include "mapmark.h"
#include "maps.h"
#include "message.h"
-#include "mon-util.h"
-#include "monplace.h"
-#include "monstuff.h"
#include "place.h"
#include "spl-util.h"
#include "view.h"
-#define MONSLIST_METATABLE "crawldgn.monster_list"
-#define ITEMLIST_METATABLE "crawldgn.item_list"
-
-static mons_list _lua_get_mlist(lua_State *ls, int ndx)
-{
- if (lua_isstring(ls, ndx))
- {
- const char *spec = lua_tostring(ls, ndx);
- mons_list mlist;
- const std::string err = mlist.add_mons(spec);
- if (!err.empty())
- luaL_error(ls, err.c_str());
- return (mlist);
- }
- else
- {
- mons_list **mlist =
- clua_get_userdata<mons_list*>(ls, MONSLIST_METATABLE, ndx);
- if (mlist)
- return (**mlist);
-
- luaL_argerror(ls, ndx, "Expected monster list object or string");
- return mons_list();
- }
-}
-
-static item_list _lua_get_ilist(lua_State *ls, int ndx)
-{
- if (lua_isstring(ls, ndx))
- {
- const char *spec = lua_tostring(ls, ndx);
-
- item_list ilist;
- const std::string err = ilist.add_item(spec);
- if (!err.empty())
- luaL_error(ls, err.c_str());
-
- return (ilist);
- }
- else
- {
- item_list **ilist =
- clua_get_userdata<item_list*>(ls, ITEMLIST_METATABLE, ndx);
- if (ilist)
- return (**ilist);
-
- luaL_argerror(ls, ndx, "Expected item list object or string");
- return item_list();
- }
-}
-
-void register_mapdef_tables(lua_State *ls)
-{
- clua_register_metatable(ls, MONSLIST_METATABLE, NULL,
- lua_object_gc<mons_list>);
- clua_register_metatable(ls, ITEMLIST_METATABLE, NULL,
- lua_object_gc<item_list>);
-}
-
-template <class T>
-static void _push_object_type(lua_State *ls, const char *meta, const T &data)
-{
- T **ptr = clua_new_userdata<T*>(ls, meta);
- *ptr = new T(data);
-}
-
///////////////////////////////////////////////////////////////////////////
// Lua dungeon bindings (in the dgn table).
@@ -379,151 +309,6 @@ static int dgn_change_branch_flags(lua_State *ls)
return (1);
}
-static int dgn_set_random_mon_list(lua_State *ls)
-{
- // Don't complain if we're being called when the map is being loaded
- // and validated.
- if (you.level_type != LEVEL_PORTAL_VAULT &&
- !(you.start_time == 0 && !you.entering_level && !Generating_Level))
- {
- luaL_error(ls, "Can only be used in portal vaults.");
- return (0);
- }
-
- const int nargs = lua_gettop(ls);
-
- map_def *map = NULL;
- if (nargs > 2)
- {
- luaL_error(ls, "Too many arguments.");
- return (0);
- }
- else if (nargs == 0)
- {
- luaL_error(ls, "Too few arguments.");
- return (0);
- }
- else if (nargs == 2)
- {
- map_def **_map =
- clua_get_userdata<map_def*>(ls, MAP_METATABLE, 1);
- map = *_map;
- }
-
- if (map)
- {
- if (map->orient != MAP_ENCOMPASS || map->place.is_valid()
- || !map->depths.empty())
- {
- luaL_error(ls, "Can only be used in portal vaults.");
- return (0);
- }
- }
-
- int list_pos = (map != NULL) ? 2 : 1;
- mons_list mlist = _lua_get_mlist(ls, list_pos);
-
- if (mlist.size() == 0)
- {
- luaL_argerror(ls, list_pos, "Mon list is empty.");
- return (0);
- }
-
- if (mlist.size() > 1)
- {
- luaL_argerror(ls, list_pos, "Mon list must contain only one slot.");
- return (0);
- }
-
- const int num_mons = mlist.slot_size(0);
-
- if (num_mons == 0)
- {
- luaL_argerror(ls, list_pos, "Mon list is empty.");
- return (0);
- }
-
- std::vector<mons_spec> mons;
- int num_lords = 0;
- for (int i = 0; i < num_mons; i++)
- {
- mons_spec mon = mlist.get_monster(0, i);
-
- // Pandemonium lords are pseudo-unique, so don't randomly generate
- // them.
- if (mon.mid == MONS_PANDEMONIUM_DEMON)
- {
- num_lords++;
- continue;
- }
-
- std::string name;
- if (mon.place.is_valid())
- {
- if (mon.place.level_type == LEVEL_LABYRINTH
- || mon.place.level_type == LEVEL_PORTAL_VAULT)
- {
- std::string err;
- err = make_stringf("mon #%d: Can't use Lab or Portal as a "
- "monster place.", i + 1);
- luaL_argerror(ls, list_pos, err.c_str());
- return(0);
- }
- name = mon.place.describe();
- }
- else
- {
- if (mon.mid == RANDOM_MONSTER || mon.monbase == RANDOM_MONSTER)
- {
- std::string err;
- err = make_stringf("mon #%d: can't use random monster in "
- "list specifying random monsters", i + 1);
- luaL_argerror(ls, list_pos, err.c_str());
- return(0);
- }
- if (mon.mid == -1)
- mon.mid = MONS_PROGRAM_BUG;
- name = mons_type_name(mon.mid, DESC_PLAIN);
- }
-
- mons.push_back(mon);
-
- if (mon.number != 0)
- mprf(MSGCH_ERROR, "dgn.set_random_mon_list() : number for %s "
- "being discarded.",
- name.c_str());
-
- if (mon.band)
- mprf(MSGCH_ERROR, "dgn.set_random_mon_list() : band request for "
- "%s being ignored.",
- name.c_str());
-
- if (mon.colour != BLACK)
- mprf(MSGCH_ERROR, "dgn.set_random_mon_list() : colour for "
- "%s being ignored.",
- name.c_str());
-
- if (mon.items.size() > 0)
- mprf(MSGCH_ERROR, "dgn.set_random_mon_list() : items for "
- "%s being ignored.",
- name.c_str());
- } // for (int i = 0; i < num_mons; i++)
-
- if (mons.size() == 0 && num_lords > 0)
- {
- luaL_argerror(ls, list_pos,
- "Mon list contains only pandemonium lords.");
- return (0);
- }
-
- if (map)
- map->random_mons = mons;
- else
- set_vault_mon_list(mons);
-
- return (0);
-}
-
static int dgn_chance(lua_State *ls)
{
MAP(ls, 1, map);
@@ -1337,53 +1122,6 @@ static int dgn_terrain_changed(lua_State *ls)
return (0);
}
-static int dgn_item_from_index(lua_State *ls)
-{
- const int index = luaL_checkint(ls, 1);
-
- item_def *item = &mitm[index];
-
- if (is_valid_item(*item))
- lua_pushlightuserdata(ls, item);
- else
- lua_pushnil(ls);
-
- return (1);
-}
-
-static int dgn_mons_from_index(lua_State *ls)
-{
- const int index = luaL_checkint(ls, 1);
-
- monsters *mons = &menv[index];
-
- if (mons->type != -1)
- push_monster(ls, mons);
- else
- lua_pushnil(ls);
-
- return (1);
-}
-
-static int dgn_mons_at(lua_State *ls)
-{
- COORDS(c, 1, 2);
-
- monsters *mon = monster_at(c);
- if (mon && mon->alive())
- push_monster(ls, mon);
- else
- lua_pushnil(ls);
- return (1);
-}
-
-static int dgn_items_at(lua_State *ls)
-{
- COORDS(c, 1, 2);
- lua_push_items(ls, env.igrid(c));
- return (1);
-}
-
static int lua_dgn_set_lt_callback(lua_State *ls)
{
const char *level_type = luaL_checkstring(ls, 1);
@@ -2106,55 +1844,6 @@ static int dgn_register_lua_marker(lua_State *ls)
return (0);
}
-static int dgn_create_monster(lua_State *ls)
-{
- COORDS(c, 1, 2);
-
- mons_list mlist = _lua_get_mlist(ls, 3);
- for (int i = 0, size = mlist.size(); i < size; ++i)
- {
- mons_spec mspec = mlist.get_monster(i);
- const int mid = dgn_place_monster(mspec, you.your_level, c,
- false, false, false);
- if (mid != -1)
- {
- push_monster(ls, &menv[mid]);
- return (1);
- }
- }
- lua_pushnil(ls);
- return (1);
-}
-
-static int _dgn_monster_spec(lua_State *ls)
-{
- const mons_list mlist = _lua_get_mlist(ls, 1);
- _push_object_type<mons_list>(ls, MONSLIST_METATABLE, mlist);
- return (1);
-}
-
-static int _dgn_item_spec(lua_State *ls)
-{
- const item_list ilist = _lua_get_ilist(ls, 1);
- _push_object_type<item_list>(ls, ITEMLIST_METATABLE, ilist);
- return (1);
-}
-
-LUARET1(_dgn_max_monsters, number, MAX_MONSTERS)
-
-static int dgn_create_item(lua_State *ls)
-{
- COORDS(c, 1, 2);
-
- item_list ilist = _lua_get_ilist(ls, 3);
- const int level =
- lua_isnumber(ls, 4) ? lua_tointeger(ls, 4) : you.your_level;
-
- dgn_place_multiple_items(ilist, c, level);
- link_items();
- return (0);
-}
-
static std::auto_ptr<lua_datum> _dgn_map_safe_bounds_fn;
static bool _lua_map_place_valid(const map_def &map,
@@ -2678,13 +2367,6 @@ LUAFN(dgn_dbg_test_explore)
return (0);
}
-LUAFN(dgn_dismiss_monsters)
-{
- PLUARET(number,
- dismiss_monsters(lua_gettop(ls) == 0 ? "" :
- luaL_checkstring(ls, 1)));
-}
-
LUAWRAP(_dgn_reset_level, dgn_reset_level())
const struct luaL_reg dgn_lib[] =
@@ -2696,7 +2378,6 @@ const struct luaL_reg dgn_lib[] =
{ "dbg_test_explore", dgn_dbg_test_explore },
{ "reset_level", _dgn_reset_level },
-{ "dismiss_monsters", dgn_dismiss_monsters },
{ "default_depth", dgn_default_depth },
{ "name", dgn_name },
@@ -2751,13 +2432,8 @@ const struct luaL_reg dgn_lib[] =
{ "feature_desc_at", dgn_feature_desc_at },
{ "set_feature_desc_short", dgn_set_feature_desc_short },
{ "set_feature_desc_long", dgn_set_feature_desc_long },
-{ "item_from_index", dgn_item_from_index },
-{ "mons_from_index", dgn_mons_from_index },
-{ "mons_at", dgn_mons_at },
-{ "items_at", dgn_items_at },
{ "change_level_flags", dgn_change_level_flags },
{ "change_branch_flags", dgn_change_branch_flags },
-{ "set_random_mon_list", dgn_set_random_mon_list },
{ "get_floor_colour", dgn_get_floor_colour },
{ "get_rock_colour", dgn_get_rock_colour },
{ "change_floor_colour", dgn_change_floor_colour },
@@ -2796,14 +2472,6 @@ const struct luaL_reg dgn_lib[] =
{ "register_feature_marker", dgn_register_feature_marker },
{ "register_lua_marker", dgn_register_lua_marker },
-{ "create_monster", dgn_create_monster },
-{ "create_item", dgn_create_item },
-
-{ "monster_spec", _dgn_monster_spec },
-{ "item_spec", _dgn_item_spec },
-
-{ "max_monsters", _dgn_max_monsters },
-
{ "with_map_bounds_fn", dgn_with_map_bounds_fn },
{ "with_map_anchors", dgn_with_map_anchors },
diff --git a/crawl-ref/source/l_dgnit.cc b/crawl-ref/source/l_dgnit.cc
new file mode 100644
index 0000000000..4fb101d4e3
--- /dev/null
+++ b/crawl-ref/source/l_dgnit.cc
@@ -0,0 +1,97 @@
+/*
+ * File: l_dgnit.cc
+ * Summary: Item-related functions in lua library "dgn".
+ */
+
+#include "AppHdr.h"
+
+#include "dlua.h"
+#include "l_libs.h"
+
+#include "dungeon.h"
+#include "items.h"
+#include "mapdef.h"
+
+#define ITEMLIST_METATABLE "crawldgn.item_list"
+
+static item_list _lua_get_ilist(lua_State *ls, int ndx)
+{
+ if (lua_isstring(ls, ndx))
+ {
+ const char *spec = lua_tostring(ls, ndx);
+
+ item_list ilist;
+ const std::string err = ilist.add_item(spec);
+ if (!err.empty())
+ luaL_error(ls, err.c_str());
+
+ return (ilist);
+ }
+ else
+ {
+ item_list **ilist =
+ clua_get_userdata<item_list*>(ls, ITEMLIST_METATABLE, ndx);
+ if (ilist)
+ return (**ilist);
+
+ luaL_argerror(ls, ndx, "Expected item list object or string");
+ return item_list();
+ }
+}
+
+void register_itemlist(lua_State *ls)
+{
+ clua_register_metatable(ls, ITEMLIST_METATABLE, NULL,
+ lua_object_gc<item_list>);
+}
+
+static int dgn_item_from_index(lua_State *ls)
+{
+ const int index = luaL_checkint(ls, 1);
+
+ item_def *item = &mitm[index];
+
+ if (is_valid_item(*item))
+ lua_pushlightuserdata(ls, item);
+ else
+ lua_pushnil(ls);
+
+ return (1);
+}
+
+static int dgn_items_at(lua_State *ls)
+{
+ COORDS(c, 1, 2);
+ lua_push_items(ls, env.igrid(c));
+ return (1);
+}
+
+static int _dgn_item_spec(lua_State *ls)
+{
+ const item_list ilist = _lua_get_ilist(ls, 1);
+ dlua_push_object_type<item_list>(ls, ITEMLIST_METATABLE, ilist);
+ return (1);
+}
+
+static int dgn_create_item(lua_State *ls)
+{
+ COORDS(c, 1, 2);
+
+ item_list ilist = _lua_get_ilist(ls, 3);
+ const int level =
+ lua_isnumber(ls, 4) ? lua_tointeger(ls, 4) : you.your_level;
+
+ dgn_place_multiple_items(ilist, c, level);
+ link_items();
+ return (0);
+}
+
+const struct luaL_reg dgn_item_lib[] =
+{
+{ "item_from_index", dgn_item_from_index },
+{ "items_at", dgn_items_at },
+{ "create_item", dgn_create_item },
+{ "item_spec", _dgn_item_spec },
+
+{ NULL, NULL }
+};
diff --git a/crawl-ref/source/l_dgnmon.cc b/crawl-ref/source/l_dgnmon.cc
new file mode 100644
index 0000000000..a464a4fb50
--- /dev/null
+++ b/crawl-ref/source/l_dgnmon.cc
@@ -0,0 +1,267 @@
+/*
+ * File: l_dgnmon.cc
+ * Summary: Monster-related functions in lua library "dgn".
+ */
+
+#include "AppHdr.h"
+
+#include "dlua.h"
+#include "l_libs.h"
+
+#include "dungeon.h"
+#include "mapdef.h"
+#include "mon-util.h"
+#include "monplace.h"
+#include "monstuff.h"
+
+#define MONSLIST_METATABLE "crawldgn.monster_list"
+
+static mons_list _lua_get_mlist(lua_State *ls, int ndx)
+{
+ if (lua_isstring(ls, ndx))
+ {
+ const char *spec = lua_tostring(ls, ndx);
+ mons_list mlist;
+ const std::string err = mlist.add_mons(spec);
+ if (!err.empty())
+ luaL_error(ls, err.c_str());
+ return (mlist);
+ }
+ else
+ {
+ mons_list **mlist =
+ clua_get_userdata<mons_list*>(ls, MONSLIST_METATABLE, ndx);
+ if (mlist)
+ return (**mlist);
+
+ luaL_argerror(ls, ndx, "Expected monster list object or string");
+ return mons_list();
+ }
+}
+
+void register_monslist(lua_State *ls)
+{
+ clua_register_metatable(ls, MONSLIST_METATABLE, NULL,
+ lua_object_gc<mons_list>);
+}
+
+static int dgn_set_random_mon_list(lua_State *ls)
+{
+ // Don't complain if we're being called when the map is being loaded
+ // and validated.
+ if (you.level_type != LEVEL_PORTAL_VAULT &&
+ !(you.start_time == 0 && !you.entering_level && !Generating_Level))
+ {
+ luaL_error(ls, "Can only be used in portal vaults.");
+ return (0);
+ }
+
+ const int nargs = lua_gettop(ls);
+
+ map_def *map = NULL;
+ if (nargs > 2)
+ {
+ luaL_error(ls, "Too many arguments.");
+ return (0);
+ }
+ else if (nargs == 0)
+ {
+ luaL_error(ls, "Too few arguments.");
+ return (0);
+ }
+ else if (nargs == 2)
+ {
+ map_def **_map =
+ clua_get_userdata<map_def*>(ls, MAP_METATABLE, 1);
+ map = *_map;
+ }
+
+ if (map)
+ {
+ if (map->orient != MAP_ENCOMPASS || map->place.is_valid()
+ || !map->depths.empty())
+ {
+ luaL_error(ls, "Can only be used in portal vaults.");
+ return (0);
+ }
+ }
+
+ int list_pos = (map != NULL) ? 2 : 1;
+ mons_list mlist = _lua_get_mlist(ls, list_pos);
+
+ if (mlist.size() == 0)
+ {
+ luaL_argerror(ls, list_pos, "Mon list is empty.");
+ return (0);
+ }
+
+ if (mlist.size() > 1)
+ {
+ luaL_argerror(ls, list_pos, "Mon list must contain only one slot.");
+ return (0);
+ }
+
+ const int num_mons = mlist.slot_size(0);
+
+ if (num_mons == 0)
+ {
+ luaL_argerror(ls, list_pos, "Mon list is empty.");
+ return (0);
+ }
+
+ std::vector<mons_spec> mons;
+ int num_lords = 0;
+ for (int i = 0; i < num_mons; i++)
+ {
+ mons_spec mon = mlist.get_monster(0, i);
+
+ // Pandemonium lords are pseudo-unique, so don't randomly generate
+ // them.
+ if (mon.mid == MONS_PANDEMONIUM_DEMON)
+ {
+ num_lords++;
+ continue;
+ }
+
+ std::string name;
+ if (mon.place.is_valid())
+ {
+ if (mon.place.level_type == LEVEL_LABYRINTH
+ || mon.place.level_type == LEVEL_PORTAL_VAULT)
+ {
+ std::string err;
+ err = make_stringf("mon #%d: Can't use Lab or Portal as a "
+ "monster place.", i + 1);
+ luaL_argerror(ls, list_pos, err.c_str());
+ return(0);
+ }
+ name = mon.place.describe();
+ }
+ else
+ {
+ if (mon.mid == RANDOM_MONSTER || mon.monbase == RANDOM_MONSTER)
+ {
+ std::string err;
+ err = make_stringf("mon #%d: can't use random monster in "
+ "list specifying random monsters", i + 1);
+ luaL_argerror(ls, list_pos, err.c_str());
+ return(0);
+ }
+ if (mon.mid == -1)
+ mon.mid = MONS_PROGRAM_BUG;
+ name = mons_type_name(mon.mid, DESC_PLAIN);
+ }
+
+ mons.push_back(mon);
+
+ if (mon.number != 0)
+ mprf(MSGCH_ERROR, "dgn.set_random_mon_list() : number for %s "
+ "being discarded.",
+ name.c_str());
+
+ if (mon.band)
+ mprf(MSGCH_ERROR, "dgn.set_random_mon_list() : band request for "
+ "%s being ignored.",
+ name.c_str());
+
+ if (mon.colour != BLACK)
+ mprf(MSGCH_ERROR, "dgn.set_random_mon_list() : colour for "
+ "%s being ignored.",
+ name.c_str());
+
+ if (mon.items.size() > 0)
+ mprf(MSGCH_ERROR, "dgn.set_random_mon_list() : items for "
+ "%s being ignored.",
+ name.c_str());
+ } // for (int i = 0; i < num_mons; i++)
+
+ if (mons.size() == 0 && num_lords > 0)
+ {
+ luaL_argerror(ls, list_pos,
+ "Mon list contains only pandemonium lords.");
+ return (0);
+ }
+
+ if (map)
+ map->random_mons = mons;
+ else
+ set_vault_mon_list(mons);
+
+ return (0);
+}
+
+static int dgn_mons_from_index(lua_State *ls)
+{
+ const int index = luaL_checkint(ls, 1);
+
+ monsters *mons = &menv[index];
+
+ if (mons->type != -1)
+ push_monster(ls, mons);
+ else
+ lua_pushnil(ls);
+
+ return (1);
+}
+
+static int dgn_mons_at(lua_State *ls)
+{
+ COORDS(c, 1, 2);
+
+ monsters *mon = monster_at(c);
+ if (mon && mon->alive())
+ push_monster(ls, mon);
+ else
+ lua_pushnil(ls);
+ return (1);
+}
+
+
+static int dgn_create_monster(lua_State *ls)
+{
+ COORDS(c, 1, 2);
+
+ mons_list mlist = _lua_get_mlist(ls, 3);
+ for (int i = 0, size = mlist.size(); i < size; ++i)
+ {
+ mons_spec mspec = mlist.get_monster(i);
+ const int mid = dgn_place_monster(mspec, you.your_level, c,
+ false, false, false);
+ if (mid != -1)
+ {
+ push_monster(ls, &menv[mid]);
+ return (1);
+ }
+ }
+ lua_pushnil(ls);
+ return (1);
+}
+
+static int _dgn_monster_spec(lua_State *ls)
+{
+ const mons_list mlist = _lua_get_mlist(ls, 1);
+ dlua_push_object_type<mons_list>(ls, MONSLIST_METATABLE, mlist);
+ return (1);
+}
+
+LUARET1(_dgn_max_monsters, number, MAX_MONSTERS)
+
+LUAFN(dgn_dismiss_monsters)
+{
+ PLUARET(number,
+ dismiss_monsters(lua_gettop(ls) == 0 ? "" :
+ luaL_checkstring(ls, 1)));
+}
+
+const struct luaL_reg dgn_mons_lib[] =
+{
+{ "set_random_mon_list", dgn_set_random_mon_list },
+{ "mons_from_index", dgn_mons_from_index },
+{ "mons_at", dgn_mons_at },
+{ "create_monster", dgn_create_monster },
+{ "monster_spec", _dgn_monster_spec },
+{ "max_monsters", _dgn_max_monsters },
+{ "dismiss_monsters", dgn_dismiss_monsters },
+
+{ NULL, NULL }
+};
diff --git a/crawl-ref/source/l_libs.h b/crawl-ref/source/l_libs.h
index bf721ab3a2..f6903f5118 100644
--- a/crawl-ref/source/l_libs.h
+++ b/crawl-ref/source/l_libs.h
@@ -3,11 +3,16 @@
* Summary: Library definitions for dlua.
*/
+#ifndef L_LIBS_H
+#define L_LIBS_H
+
#include "clua.h"
extern const struct luaL_reg crawl_lib[];
extern const struct luaL_reg dgn_lib[];
extern const struct luaL_reg dgn_event_lib[];
+extern const struct luaL_reg dgn_item_lib[];
+extern const struct luaL_reg dgn_mons_lib[];
extern const struct luaL_reg file_lib[];
extern const struct luaL_reg los_lib[];
extern const struct luaL_reg mapmarker_lib[];
@@ -17,6 +22,9 @@ void luaopen_dgnevent(lua_State *ls);
void luaopen_mapmarker(lua_State *ls);
void luaopen_ray(lua_State *ls);
-void register_mapdef_tables(lua_State *ls);
+void register_monslist(lua_State *ls);
+void register_itemlist(lua_State *ls);
void register_builder_funcs(lua_State *ls);
+#endif
+
diff --git a/crawl-ref/source/makefile.obj b/crawl-ref/source/makefile.obj
index fadd7505e1..4478e1f8cb 100644
--- a/crawl-ref/source/makefile.obj
+++ b/crawl-ref/source/makefile.obj
@@ -40,8 +40,10 @@ lev-pand.o \
libutil.o \
l_crawl.o \
l_dgn.o \
-l_dgn_bf.o \
l_dgnevt.o \
+l_dgnit.o \
+l_dgnmon.o \
+l_dgn_bf.o \
l_file.o \
l_los.o \
l_mapmrk.o \