diff options
author | Jude Brown <bookofjude@users.sourceforge.net> | 2009-11-27 14:52:31 +1000 |
---|---|---|
committer | Jude Brown <bookofjude@users.sourceforge.net> | 2009-11-27 14:58:10 +1000 |
commit | 5194ce66d60829d7658eaf7c4e570bb88077d326 (patch) | |
tree | 9b44313f7b0cbfaa0b4d9512189867ba1fb36a1f /crawl-ref/source/l_dgngrd.cc | |
parent | 74685cd97420cc5c40d83cc1ea688863c4dd1751 (diff) | |
download | crawl-ref-5194ce66d60829d7658eaf7c4e570bb88077d326.tar.gz crawl-ref-5194ce66d60829d7658eaf7c4e570bb88077d326.zip |
New Lua library: feat.
Provides wrappers for all of the feat_is_XXX functions from terrain.cc,
as well as a few other functions. Also provides a macro which can wrap a
function to take:
* a set of co-ordinates (parsed with grd(coord_def(x, y)))
* a string (parsed with dungeon_feature_by_name)
* an integer (cast into dungeon_feature_type, can be fetched from
dgn.grid(x, y))
All of the feat library functions can be used in this manner. For
example:
* feat.is_wall(x, y)
* feat.is_wall(dgn.grid(x, y))
* feat.is_wall(7)
* feat.is_wall("rock_wall")
Diffstat (limited to 'crawl-ref/source/l_dgngrd.cc')
-rw-r--r-- | crawl-ref/source/l_dgngrd.cc | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/crawl-ref/source/l_dgngrd.cc b/crawl-ref/source/l_dgngrd.cc index d72dab589c..c5e89b175f 100644 --- a/crawl-ref/source/l_dgngrd.cc +++ b/crawl-ref/source/l_dgngrd.cc @@ -160,10 +160,6 @@ static int dgn_grid(lua_State *ls) PLUARET(number, grd(c)); } -// XXX: these two shouldn't be so different. -LUARET1(_dgn_is_wall, boolean, - feat_is_wall(static_cast<dungeon_feature_type>(luaL_checkint(ls, 1)))) - LUAFN(dgn_distance) { COORDS(p1, 1, 2); @@ -172,13 +168,6 @@ LUAFN(dgn_distance) return (1); } -LUAFN(_dgn_is_opaque) -{ - COORDS(c, 1, 2); - lua_pushboolean(ls, feat_is_opaque(grd(c))); - return (1); -} - LUAFN(dgn_seen_replace_feat) { dungeon_feature_type f1 = _get_lua_feature(ls, 1); @@ -200,11 +189,11 @@ const struct luaL_reg dgn_grid_dlib[] = { "seen_replace_feat", dgn_seen_replace_feat }, { "grid", dgn_grid }, -{ "is_opaque", _dgn_is_opaque }, -{ "is_wall", _dgn_is_wall }, { "max_bounds", dgn_max_bounds }, { "in_bounds", dgn_in_bounds }, { "distance", dgn_distance }, + + { NULL, NULL } }; |