diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-10-27 21:25:59 +0100 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-10-27 23:16:54 +0100 |
commit | bf18513ac06c9a214f07c9a90560ebb8356ae1b0 (patch) | |
tree | 8e229f6aabf9db877b20f4a368b669d93309f87d /crawl-ref/source/l_view.cc | |
parent | 227fc6f7a56b489b3758ab4c89714d0c447b10b3 (diff) | |
download | crawl-ref-bf18513ac06c9a214f07c9a90560ebb8356ae1b0.tar.gz crawl-ref-bf18513ac06c9a214f07c9a90560ebb8356ae1b0.zip |
Add lua binding for inspecting env.show.
Diffstat (limited to 'crawl-ref/source/l_view.cc')
-rw-r--r-- | crawl-ref/source/l_view.cc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/crawl-ref/source/l_view.cc b/crawl-ref/source/l_view.cc new file mode 100644 index 0000000000..23175d3670 --- /dev/null +++ b/crawl-ref/source/l_view.cc @@ -0,0 +1,37 @@ +/* + * File: l_view.cc + * Summary: User interaction with env.show. + */ + +#include "AppHdr.h" + +#include "l_libs.h" + +#include "cluautil.h" +#include "env.h" +#include "l_defs.h" + +coord_def player2show(const coord_def &s) +{ + return (s + coord_def(ENV_SHOW_OFFSET, ENV_SHOW_OFFSET)); +} + +LUAFN(view_feature_at) +{ + COORDSHOW(s, 1, 2) + const coord_def p = player2show(s); + lua_pushnumber(ls, env.show(p)); + return (1); +} + +static const struct luaL_reg view_lib[] = +{ + { "feature_at", view_feature_at }, + + { NULL, NULL } +}; + +void cluaopen_view(lua_State *ls) +{ + luaL_openlib(ls, "view", view_lib, 0); +} |