summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-goditem.cc
diff options
context:
space:
mode:
authorDracoOmega <draco_omega@live.com>2013-04-09 01:38:05 -0230
committerDracoOmega <draco_omega@live.com>2013-05-26 18:58:16 -0230
commite87be793bbbc04d08e7506eac6326a0cd25f9851 (patch)
treecad44ec2fdf2ce046785ee2e99d91b70ee8b07b7 /crawl-ref/source/spl-goditem.cc
parent1311a4fdf40b488ff3dd9923a9e355ac1099bd7b (diff)
downloadcrawl-ref-e87be793bbbc04d08e7506eac6326a0cd25f9851.tar.gz
crawl-ref-e87be793bbbc04d08e7506eac6326a0cd25f9851.zip
Refactor tomb effects to use terrain change markers
In addition to unifying code, this also has the effect of making tombs created over shallow water restore shallow water when they disappeared and Zin prisons restore the proper underlying feature if the walls are forcibly destroyed instead of expiring (ie: with LRD or shatter).
Diffstat (limited to 'crawl-ref/source/spl-goditem.cc')
-rw-r--r--crawl-ref/source/spl-goditem.cc20
1 files changed, 8 insertions, 12 deletions
diff --git a/crawl-ref/source/spl-goditem.cc b/crawl-ref/source/spl-goditem.cc
index ce791ef058..7ebd913a76 100644
--- a/crawl-ref/source/spl-goditem.cc
+++ b/crawl-ref/source/spl-goditem.cc
@@ -897,23 +897,22 @@ static bool _do_imprison(int pow, const coord_def& where, bool zin)
// All traps are destroyed.
if (trap_def *ptrap = find_trap(*ai))
+ {
ptrap->destroy();
+ grd(*ai) = DNGN_FLOOR;
+ }
// Actually place the wall.
if (zin)
{
map_wiz_props_marker *marker = new map_wiz_props_marker(*ai);
marker->set_property("feature_description", "a gleaming silver wall");
- marker->set_property("tomb", "Zin");
-
- // Preserve the old feature, unless it's bare floor (or trap)
- if (grd(*ai) != DNGN_FLOOR & !feat_is_trap(grd(*ai), true))
- marker->set_property("old_feat", dungeon_feature_name(grd(*ai)));
-
env.markers.add(marker);
+ temp_change_terrain(*ai, DNGN_METAL_WALL, INFINITE_DURATION,
+ TERRAIN_CHANGE_IMPRISON);
+
// Make the walls silver.
- grd(*ai) = DNGN_METAL_WALL;
env.grid_colours(*ai) = WHITE;
env.tile_flv(*ai).feat_idx =
store_tilename_get_index("dngn_mirror_wall");
@@ -931,13 +930,10 @@ static bool _do_imprison(int pow, const coord_def& where, bool zin)
// Tomb card
else
{
- grd(*ai) = DNGN_ROCK_WALL;
- map_wiz_props_marker *marker = new map_wiz_props_marker(*ai);
- marker->set_property("tomb", "card");
- env.markers.add(marker);
+ temp_change_terrain(*ai, DNGN_ROCK_WALL, INFINITE_DURATION,
+ TERRAIN_CHANGE_TOMB);
}
- set_terrain_changed(*ai);
number_built++;
}
}