From ab37888b365daa63b738c76ae6e67a0210899ff5 Mon Sep 17 00:00:00 2001 From: Michael Meyer Date: Fri, 9 Jun 2023 10:55:22 -0400 Subject: [PATCH] Restore altar destruction from magical digging Especially powerful magic is meant to be able to destroy altars (breaking a wand of digging or using a drum of earthquake), but it was being blocked by a check added to maketrap() in a7f6460 designed to prevent wizard-mode trap wishing from overwriting stairs. The check was refined in 6a3d82c to add an exception for digging up graves, but continued to prevent the destruction of other types of previously-destructible terrain. Since this block was a side effect of an attempt to add some guard rails to wizmode terrain wishes, and the code to explicitly permit the destruction of other furniture with especially powerful magic is still present, it doesn't seem like it was actually intended. Open up terrain destruction by digging magic a bit more by excluding only non-destructible terrain, not all furniture other than graves, from being overwritten by pits and holes. Also, use AM_SANCTUM to more precisely identify non-destructible high altars in dig_check() rather than checking whether the hero is on the Astral or Sanctum levels. --- src/dig.c | 4 ++-- src/trap.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/dig.c b/src/dig.c index 7ea05bc07..93c64c5bf 100644 --- a/src/dig.c +++ b/src/dig.c @@ -194,8 +194,8 @@ dig_check(struct monst *madeby, boolean verbose, coordxy x, coordxy y) pline_The("throne is too hard to break apart."); return FALSE; } else if (IS_ALTAR(levl[x][y].typ) - && (madeby != BY_OBJECT || Is_astralevel(&u.uz) - || Is_sanctum(&u.uz))) { + && (madeby != BY_OBJECT + || (altarmask_at(x, y) & AM_SANCTUM) != 0)) { if (verbose) pline_The("altar is too hard to break apart."); return FALSE; diff --git a/src/trap.c b/src/trap.c index 0989ed7da..77a99ea0d 100644 --- a/src/trap.c +++ b/src/trap.c @@ -470,8 +470,9 @@ maketrap(coordxy x, coordxy y, int typ) || (u.utraptype == TT_LAVA && !is_lava(x, y)))) reset_utrap(FALSE); /* old remain valid */ - } else if ((IS_FURNITURE(lev->typ) - && (!IS_GRAVE(lev->typ) || (typ != PIT && typ != HOLE))) + } else if (!CAN_OVERWRITE_TERRAIN(lev->typ) + || (IS_FURNITURE(lev->typ) + && (typ != PIT && typ != HOLE)) || is_pool_or_lava(x, y) || (IS_AIR(lev->typ) && typ != MAGIC_PORTAL) || (typ == LEVEL_TELEP && single_level_branch(&u.uz))) {