diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-10-21 11:31:49 +0200 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-10-21 11:36:17 +0200 |
commit | 7974b1cb0ff0b1d4e20550a3bc731b5c7df7ed10 (patch) | |
tree | ca6bf748c7b6d0156e7c43310c846b97e3f43c00 /crawl-ref/source/l_libs.h | |
parent | 3ab7bb0a81e4d519d8ce6a8f44199cf70d243b0e (diff) | |
download | crawl-ref-7974b1cb0ff0b1d4e20550a3bc731b5c7df7ed10.tar.gz crawl-ref-7974b1cb0ff0b1d4e20550a3bc731b5c7df7ed10.zip |
Move more macros and functions to cluautil.cc.
Diffstat (limited to 'crawl-ref/source/l_libs.h')
-rw-r--r-- | crawl-ref/source/l_libs.h | 48 |
1 files changed, 1 insertions, 47 deletions
diff --git a/crawl-ref/source/l_libs.h b/crawl-ref/source/l_libs.h index 705ff65aae..9913a5748e 100644 --- a/crawl-ref/source/l_libs.h +++ b/crawl-ref/source/l_libs.h @@ -35,7 +35,7 @@ void cluaopen_globals(lua_State *ls); /* * Libraries and loaders for dlua, accessed from init_dungeon_lua(). - * TODO: Rename these to dluaopen_*. + * TODO: Rename these to dluaopen_*? */ extern const struct luaL_reg debug_dlib[]; @@ -63,48 +63,6 @@ void dluaopen_file(lua_State *ls); void dluaopen_mapgrd(lua_State *ls); void dluaopen_you(lua_State *ls); -/* - * Macros for processing object arguments. - * TODO: Collect these in cluautil.{h,cc}. - */ -#define GETCOORD(c, p1, p2, boundfn) \ - coord_def c; \ - c.x = luaL_checkint(ls, p1); \ - c.y = luaL_checkint(ls, p2); \ - if (!boundfn(c)) \ - luaL_error( \ - ls, \ - make_stringf("Point (%d,%d) is out of bounds", \ - c.x, c.y).c_str()); \ - else ; - - -#define COORDS(c, p1, p2) \ - GETCOORD(c, p1, p2, in_bounds) - -#define FEAT(f, pos) \ -dungeon_feature_type f = check_lua_feature(ls, pos) - -#define LUA_ITEM(name, n) \ - item_def *name = clua_check_item(ls, n); - -#define LEVEL(lev, br, pos) \ -const char *level_name = luaL_checkstring(ls, pos); \ -level_area_type lev = str_to_level_area_type(level_name); \ -if (lev == NUM_LEVEL_AREA_TYPES) \ -luaL_error(ls, "Expected level name"); \ -const char *branch_name = luaL_checkstring(ls, pos); \ -branch_type br = str_to_branch(branch_name); \ -if (lev == LEVEL_DUNGEON && br == NUM_BRANCHES) \ -luaL_error(ls, "Expected branch name"); - -#define MAP(ls, n, var) \ -map_def *var = *(map_def **) luaL_checkudata(ls, n, MAP_METATABLE) -#define DEVENT(ls, n, var) \ -dgn_event *var = *(dgn_event **) luaL_checkudata(ls, n, DEVENT_METATABLE) -#define MAPMARKER(ls, n, var) \ -map_marker *var = *(map_marker **) luaL_checkudata(ls, n, MAPMARK_METATABLE) - /* * Some shared helper functions. @@ -112,9 +70,5 @@ map_marker *var = *(map_marker **) luaL_checkudata(ls, n, MAPMARK_METATABLE) class map_lines; int dgn_map_add_transform(lua_State *ls, std::string (map_lines::*add)(const std::string &s)); -unsigned int get_tile_idx(lua_State *ls, int arg); -level_id dlua_level_id(lua_State *ls, int ndx); -dungeon_feature_type check_lua_feature(lua_State *ls, int idx); -item_def *clua_check_item(lua_State *ls, int n); #endif |