summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_dgn.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2012-07-04 17:47:01 +0200
committerAdam Borowski <kilobyte@angband.pl>2012-07-05 12:10:36 +0200
commit84529d68d19b47489f41615bf64f90e1639ff0a7 (patch)
tree0f5157f004e1ae16443f1731f15d34ca614e60a5 /crawl-ref/source/l_dgn.cc
parent7d59203a59442246db2d4cde035d5587c2f8ea81 (diff)
downloadcrawl-ref-84529d68d19b47489f41615bf64f90e1639ff0a7.tar.gz
crawl-ref-84529d68d19b47489f41615bf64f90e1639ff0a7.zip
Make feature renames local to a vault rather than the whole level.
For technical reasons (vault_placement), subvaults use renaming data of the top-level vault, this might be changed one day; that'd require a bit more writing but would allow different renames in different subvaults. TODO: "line of fire blocked by XXX".
Diffstat (limited to 'crawl-ref/source/l_dgn.cc')
-rw-r--r--crawl-ref/source/l_dgn.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/crawl-ref/source/l_dgn.cc b/crawl-ref/source/l_dgn.cc
index 2e3267dce7..28eec1a6a2 100644
--- a/crawl-ref/source/l_dgn.cc
+++ b/crawl-ref/source/l_dgn.cc
@@ -1025,6 +1025,26 @@ static int lua_dgn_set_border_fill_type(lua_State *ls)
return (0);
}
+static int lua_dgn_set_feature_name(lua_State *ls)
+{
+ MAP(ls, 1, map);
+ if (lua_gettop(ls) != 3)
+ luaL_error(ls, "set_feature_name takes a feature and the new name.");
+
+ std::string feat_string = luaL_checkstring(ls, 2);
+ dungeon_feature_type feat_type = dungeon_feature_by_name(feat_string);
+
+ if (feat_type == DNGN_UNSEEN)
+ {
+ luaL_error(ls, ("unknown feature '" + feat_string + "'.").c_str());
+ return 0;
+ }
+
+ map->feat_renames[feat_type] = luaL_checkstring(ls, 3);
+
+ return (0);
+}
+
static int dgn_floor_halo(lua_State *ls)
{
std::string error = "";
@@ -1840,6 +1860,7 @@ const struct luaL_reg dgn_dlib[] =
{ "change_rock_colour", dgn_change_rock_colour },
{ "set_branch_epilogue", lua_dgn_set_branch_epilogue },
{ "set_border_fill_type", lua_dgn_set_border_fill_type },
+{ "set_feature_name", lua_dgn_set_feature_name },
{ "floor_halo", dgn_floor_halo },
{ "random_walk", dgn_random_walk },
{ "apply_area_cloud", dgn_apply_area_cloud },