summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-10-19 23:17:53 +0200
committerRobert Vollmert <rvollmert@gmx.net>2009-10-19 23:17:53 +0200
commit8e048c2d18e3b0032ae7e1442f1a2500cba3a3aa (patch)
tree2fe6841a9609ea0d4a1efcd39af6e20e8bfd40a6
parent49a01f5ae457bb601165eb89f6437d392a036eae (diff)
downloadcrawl-ref-8e048c2d18e3b0032ae7e1442f1a2500cba3a3aa.tar.gz
crawl-ref-8e048c2d18e3b0032ae7e1442f1a2500cba3a3aa.zip
Split out dgnevent_lib from dlua.cc.
-rw-r--r--crawl-ref/source/dlua.cc51
-rw-r--r--crawl-ref/source/l_dgnevt.cc58
-rw-r--r--crawl-ref/source/l_libs.h1
-rw-r--r--crawl-ref/source/makefile.obj1
4 files changed, 60 insertions, 51 deletions
diff --git a/crawl-ref/source/dlua.cc b/crawl-ref/source/dlua.cc
index 9af08e3829..718438b9e9 100644
--- a/crawl-ref/source/dlua.cc
+++ b/crawl-ref/source/dlua.cc
@@ -321,57 +321,6 @@ std::string dlua_chunk::get_chunk_prefix(const std::string &sorig) const
return rewrite_chunk_prefix(sorig, true);
}
-static int dgnevent_type(lua_State *ls)
-{
- DEVENT(ls, 1, dev);
- PLUARET(number, dev->type);
-}
-
-static int dgnevent_place(lua_State *ls)
-{
- DEVENT(ls, 1, dev);
- lua_pushnumber(ls, dev->place.x);
- lua_pushnumber(ls, dev->place.y);
- return (2);
-}
-
-static int dgnevent_dest(lua_State *ls)
-{
- DEVENT(ls, 1, dev);
- lua_pushnumber(ls, dev->dest.x);
- lua_pushnumber(ls, dev->dest.y);
- return (2);
-}
-
-static int dgnevent_ticks(lua_State *ls)
-{
- DEVENT(ls, 1, dev);
- PLUARET(number, dev->elapsed_ticks);
-}
-
-static int dgnevent_arg1(lua_State *ls)
-{
- DEVENT(ls, 1, dev);
- PLUARET(number, dev->arg1);
-}
-
-static int dgnevent_arg2(lua_State *ls)
-{
- DEVENT(ls, 1, dev);
- PLUARET(number, dev->arg2);
-}
-
-static const struct luaL_reg dgnevent_lib[] =
-{
- { "type", dgnevent_type },
- { "pos", dgnevent_place },
- { "dest", dgnevent_dest },
- { "ticks", dgnevent_ticks },
- { "arg1", dgnevent_arg1 },
- { "arg2", dgnevent_arg2 },
- { NULL, NULL }
-};
-
void luaopen_setmeta(lua_State *ls,
const char *global,
const luaL_reg *lua_lib,
diff --git a/crawl-ref/source/l_dgnevt.cc b/crawl-ref/source/l_dgnevt.cc
new file mode 100644
index 0000000000..8247b1fb1d
--- /dev/null
+++ b/crawl-ref/source/l_dgnevt.cc
@@ -0,0 +1,58 @@
+#include "AppHdr.h"
+
+#include "dlua.h"
+#include "l_libs.h"
+
+#include "dgnevent.h"
+
+static int dgnevent_type(lua_State *ls)
+{
+ DEVENT(ls, 1, dev);
+ PLUARET(number, dev->type);
+}
+
+static int dgnevent_place(lua_State *ls)
+{
+ DEVENT(ls, 1, dev);
+ lua_pushnumber(ls, dev->place.x);
+ lua_pushnumber(ls, dev->place.y);
+ return (2);
+}
+
+static int dgnevent_dest(lua_State *ls)
+{
+ DEVENT(ls, 1, dev);
+ lua_pushnumber(ls, dev->dest.x);
+ lua_pushnumber(ls, dev->dest.y);
+ return (2);
+}
+
+static int dgnevent_ticks(lua_State *ls)
+{
+ DEVENT(ls, 1, dev);
+ PLUARET(number, dev->elapsed_ticks);
+}
+
+static int dgnevent_arg1(lua_State *ls)
+{
+ DEVENT(ls, 1, dev);
+ PLUARET(number, dev->arg1);
+}
+
+static int dgnevent_arg2(lua_State *ls)
+{
+ DEVENT(ls, 1, dev);
+ PLUARET(number, dev->arg2);
+}
+
+const struct luaL_reg dgnevent_lib[] =
+{
+{ "type", dgnevent_type },
+{ "pos", dgnevent_place },
+{ "dest", dgnevent_dest },
+{ "ticks", dgnevent_ticks },
+{ "arg1", dgnevent_arg1 },
+{ "arg2", dgnevent_arg2 },
+{ NULL, NULL }
+};
+
diff --git a/crawl-ref/source/l_libs.h b/crawl-ref/source/l_libs.h
index cc0462e5e1..23a4359153 100644
--- a/crawl-ref/source/l_libs.h
+++ b/crawl-ref/source/l_libs.h
@@ -2,6 +2,7 @@
extern const struct luaL_reg crawl_lib[];
extern const struct luaL_reg dgn_lib[];
+extern const struct luaL_reg dgnevent_lib[];
extern const struct luaL_reg file_lib[];
extern const struct luaL_reg los_lib[];
extern const struct luaL_reg you_lib[];
diff --git a/crawl-ref/source/makefile.obj b/crawl-ref/source/makefile.obj
index daecc97926..7e90cd2b2a 100644
--- a/crawl-ref/source/makefile.obj
+++ b/crawl-ref/source/makefile.obj
@@ -40,6 +40,7 @@ lev-pand.o \
libutil.o \
l_crawl.o \
l_dgn.o \
+l_dgnevt.o \
l_file.o \
l_los.o \
l_you.o \