summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_dgntil.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2011-11-19 21:01:34 +0100
committerAdam Borowski <kilobyte@angband.pl>2011-11-19 21:01:34 +0100
commit5b6b80ccc3ae539ac05cb868fa9d00451299da59 (patch)
treee514ebd695abb2c90c269b85efbd64ac37db24a0 /crawl-ref/source/l_dgntil.cc
parentb63d4227075ae3fb862f26c022360ef384ad4110 (diff)
parent0534696989ccbd75f8352bef1b464b794cee8389 (diff)
downloadcrawl-ref-5b6b80ccc3ae539ac05cb868fa9d00451299da59.tar.gz
crawl-ref-5b6b80ccc3ae539ac05cb868fa9d00451299da59.zip
Merge branch 'master' into portal_branches
Diffstat (limited to 'crawl-ref/source/l_dgntil.cc')
-rw-r--r--crawl-ref/source/l_dgntil.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/crawl-ref/source/l_dgntil.cc b/crawl-ref/source/l_dgntil.cc
index 00ec56b01a..8e7340b6fd 100644
--- a/crawl-ref/source/l_dgntil.cc
+++ b/crawl-ref/source/l_dgntil.cc
@@ -206,6 +206,37 @@ LUAFN(dgn_tile_feat_changed)
return (0);
}
+LUAFN(dgn_tile_floor_changed)
+{
+#ifdef USE_TILE
+ COORDS(c, 1, 2);
+
+ if (lua_isnil(ls, 3))
+ {
+ env.tile_flv(c).floor = 0;
+ env.tile_flv(c).floor_idx = 0;
+ return (0);
+ }
+
+ std::string tilename = luaL_checkstring(ls, 3);
+
+ tileidx_t floor;
+ if (!tile_dngn_index(tilename.c_str(), &floor))
+ {
+ std::string error = "Couldn't find tile '";
+ error += tilename;
+ error += "'";
+ luaL_argerror(ls, 1, error.c_str());
+ return 0;
+ }
+ env.tile_flv(c).floor = floor;
+ env.tile_flv(c).floor_idx =
+ store_tilename_get_index(tilename);
+#endif
+
+ return (0);
+}
+
const struct luaL_reg dgn_tile_dlib[] =
{
{ "lrocktile", dgn_lrocktile },
@@ -218,6 +249,7 @@ const struct luaL_reg dgn_tile_dlib[] =
{ "lev_floortile", dgn_lev_floortile },
{ "lev_rocktile", dgn_lev_rocktile },
{ "tile_feat_changed", dgn_tile_feat_changed },
+{ "tile_floor_changed", dgn_tile_floor_changed },
{ NULL, NULL }
};