diff options
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/dlua.cc | 29 | ||||
-rw-r--r-- | crawl-ref/source/l_libs.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/l_mapmrk.cc | 34 | ||||
-rw-r--r-- | crawl-ref/source/makefile.obj | 1 |
4 files changed, 37 insertions, 29 deletions
diff --git a/crawl-ref/source/dlua.cc b/crawl-ref/source/dlua.cc index 718438b9e9..b83dad752c 100644 --- a/crawl-ref/source/dlua.cc +++ b/crawl-ref/source/dlua.cc @@ -342,35 +342,6 @@ static void luaopen_dgnevent(lua_State *ls) luaopen_setmeta(ls, "dgnevent", dgnevent_lib, DEVENT_METATABLE); } -static int mapmarker_pos(lua_State *ls) -{ - MAPMARKER(ls, 1, mark); - lua_pushnumber(ls, mark->pos.x); - lua_pushnumber(ls, mark->pos.y); - return (2); -} - -static int mapmarker_move(lua_State *ls) -{ - MAPMARKER(ls, 1, mark); - const coord_def dest( luaL_checkint(ls, 2), luaL_checkint(ls, 3) ); - env.markers.move_marker(mark, dest); - return (0); -} - -static const struct luaL_reg mapmarker_lib[] = -{ - { "pos", mapmarker_pos }, - { "move", mapmarker_move }, - { NULL, NULL } -}; - -static void luaopen_mapmarker(lua_State *ls) -{ - luaopen_setmeta(ls, "mapmarker", mapmarker_lib, MAPMARK_METATABLE); -} - - // Return the integer stored in the table (on the stack) with the key name. // If the key doesn't exist or the value is the wrong type, return defval. static int _table_int(lua_State *ls, int idx, const char *name, int defval) diff --git a/crawl-ref/source/l_libs.h b/crawl-ref/source/l_libs.h index 23a4359153..c1164f8afc 100644 --- a/crawl-ref/source/l_libs.h +++ b/crawl-ref/source/l_libs.h @@ -5,8 +5,10 @@ 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 mapmarker_lib[]; extern const struct luaL_reg you_lib[]; +void luaopen_mapmarker(lua_State *ls); void luaopen_ray(lua_State *ls); void register_mapdef_tables(lua_State *ls); diff --git a/crawl-ref/source/l_mapmrk.cc b/crawl-ref/source/l_mapmrk.cc new file mode 100644 index 0000000000..98c2323546 --- /dev/null +++ b/crawl-ref/source/l_mapmrk.cc @@ -0,0 +1,34 @@ +#include "AppHdr.h" + +#include "dlua.h" +#include "l_libs.h" + +#include "mapmark.h" + +static int mapmarker_pos(lua_State *ls) +{ + MAPMARKER(ls, 1, mark); + lua_pushnumber(ls, mark->pos.x); + lua_pushnumber(ls, mark->pos.y); + return (2); +} + +static int mapmarker_move(lua_State *ls) +{ + MAPMARKER(ls, 1, mark); + const coord_def dest( luaL_checkint(ls, 2), luaL_checkint(ls, 3) ); + env.markers.move_marker(mark, dest); + return (0); +} + +const struct luaL_reg mapmarker_lib[] = +{ +{ "pos", mapmarker_pos }, +{ "move", mapmarker_move }, +{ NULL, NULL } +}; + +void luaopen_mapmarker(lua_State *ls) +{ + luaopen_setmeta(ls, "mapmarker", mapmarker_lib, MAPMARK_METATABLE); +} diff --git a/crawl-ref/source/makefile.obj b/crawl-ref/source/makefile.obj index 7e90cd2b2a..7f4bbc23ac 100644 --- a/crawl-ref/source/makefile.obj +++ b/crawl-ref/source/makefile.obj @@ -43,6 +43,7 @@ l_dgn.o \ l_dgnevt.o \ l_file.o \ l_los.o \ +l_mapmrk.o \ l_you.o \ los.o \ losparam.o \ |