Several months ago I ran across an ugly feature: reading a *destruction* scroll will delete most things; unfortunately for me "most things" includes stairs. Doubly unfortunate for me, I discovered this on level 99 of an ironman game after killing Sauron, which made it kinda hard to go down to level 100 (see http://angband.oook.cz/forum/showthread.php?t=4839 if you care).
At the time, I promised to write some code to fix the problem, but of course, I never did. I have now (finally) looked into the problem. My original proposal was to add some chrome to convert the stairs into rubble, and then back to stairs once they were dug out. This looks to be a lot harder than I gave it credit for. The FEAT_* definitions in defines.h do not have any gaps in them where something could be slipped in, and the source code has at least a couple of instances of constructs like: "if (cave_feat[y][x] >= FEAT_WALL_EXTRA)" which makes adding new entries at the end somewhat problematic.
So I now propose using the simple fix of changing destroy_area in spells2.c to just skip over stairs. And in the course of investigating this, I now see where the bug slipped in: right now, destroy_area checks to see if it should skip a space by using the test "cave_isperm", whereas is older sources, this test was done using "cave_valid_bold". I am fairly certain that this was changed in order to make *destruct* effective at destroying artifacts, so that people could not use the hack of *destructing* a vault and then picking through the remains. But it has the unfortunate and probably unexpected side effect of also allowing the destruction of stairs.
The fix appears to be simple: in spells2.c:destroy_area, instead of
if (!cave_isperm(cave, y, x))
just instead use
if (!cave_perma_bold(x,y))
which will skip over stairs as well as permanent walls, but not artifacts.
At the time, I promised to write some code to fix the problem, but of course, I never did. I have now (finally) looked into the problem. My original proposal was to add some chrome to convert the stairs into rubble, and then back to stairs once they were dug out. This looks to be a lot harder than I gave it credit for. The FEAT_* definitions in defines.h do not have any gaps in them where something could be slipped in, and the source code has at least a couple of instances of constructs like: "if (cave_feat[y][x] >= FEAT_WALL_EXTRA)" which makes adding new entries at the end somewhat problematic.
So I now propose using the simple fix of changing destroy_area in spells2.c to just skip over stairs. And in the course of investigating this, I now see where the bug slipped in: right now, destroy_area checks to see if it should skip a space by using the test "cave_isperm", whereas is older sources, this test was done using "cave_valid_bold". I am fairly certain that this was changed in order to make *destruct* effective at destroying artifacts, so that people could not use the hack of *destructing* a vault and then picking through the remains. But it has the unfortunate and probably unexpected side effect of also allowing the destruction of stairs.
The fix appears to be simple: in spells2.c:destroy_area, instead of
if (!cave_isperm(cave, y, x))
just instead use
if (!cave_perma_bold(x,y))
which will skip over stairs as well as permanent walls, but not artifacts.
Comment