From 0dad60e485b8b6021e4caf9a03257cb0829deba5 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 26 Sep 2024 08:10:26 -0700 Subject: [PATCH] fix github issue #1291 - water walking vs lava Issue reported by ars3niy: non-fireproof water walking boots are supposed to be destroyed if worn on lava, but a post-3.6 change made that only happen if the hero died and left bones. The boots remained intact if hero was fire resistant or survived 6d6 damage. Staying intact should only happen if they're fireproof. This seems to work but each time lava_effects() gets modified it becomes more fragile. Having deleted objects stick around doesn't help with this problem, which is to keep an item which is being stolen--and whose loss causes the hero to drop into lava--from being burned up before being transferred to the thief's inventory. Fixes #1291 --- doc/fixes3-7-0.txt | 3 ++- src/steal.c | 15 ++------------- src/trap.c | 6 ++++-- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 013fa16c7..8ad654c8c 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -2039,7 +2039,8 @@ priestname() didn't handle "a" vs" "an" prefix correctly; normally priests are named as "the priest of " but hearing an unseen priest read a scroll doesn't force "the" and yielded "You hear an priest of incant ." - +non-fireproof water walking boots wouldn't be burnt up if fire resistant hero + walked on molten lava Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository diff --git a/src/steal.c b/src/steal.c index 45bf6adef..08b4db982 100644 --- a/src/steal.c +++ b/src/steal.c @@ -283,19 +283,8 @@ remove_worn_item( setnotworn(obj); } - /* - * Fingers crossed; hope unwearing obj didn't destroy it. Loss of - * levitation, flight, water walking, magical breathing or perhaps - * some other property can subject hero to hardship. drown() won't - * drop an 'in_use' item during emergency_disrobe() to crawl out - * of water. Surviving in_lava() only burns up items which aren't - * able to confer such properties but dying to it will destroy all - * in-use items, keeping them out of subsequent bones. Triggering - * traps might pose a risk of item destruction (fire, explosion) - * but usually that will be like the surviving lava case--the items - * that are affected aren't ones that will be unworn and trigger - * the whole mess. - */ + if (obj->where == OBJ_DELETED) + debugpline1("remove_worn_item() \"%s\" deleted!", simpleonames(obj)); obj->in_use = oldinuse; } diff --git a/src/trap.c b/src/trap.c index f83c16085..2671a1e4f 100644 --- a/src/trap.c +++ b/src/trap.c @@ -6650,13 +6650,15 @@ lava_effects(void) * (3.7: that assumption is no longer true, but having boots be the first * thing to come into contact with lava makes sense.) */ - if (uarmf && uarmf->in_use) { + if (uarmf && (uarmf->in_use + || (is_organic(uarmf) && !uarmf->oerodeproof))) { obj = uarmf; pline("%s into flame!", Yobjnam2(obj, "burst")); ++burnmesgcount; iflags.in_lava_effects++; /* (see above) */ (void) Boots_off(); - useup(obj); + if (obj->o_id != protect_oid) + useup(obj); iflags.in_lava_effects--; ++burncount; }