From 9326f80ecc1da8d9b720823153c13cb159802433 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 9 Feb 2024 15:52:17 -0800 Subject: [PATCH] lava_effects() bit lava_effects() item destrunction had the logic for handling Book of the Dead wrong. (However, that didn't matter since the obj_resists() check earlier would prevent it from being burned up. Fix it anyway.) --- src/steal.c | 6 +++--- src/trap.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/steal.c b/src/steal.c index 9ce2982bc..e137c0ab4 100644 --- a/src/steal.c +++ b/src/steal.c @@ -236,9 +236,9 @@ remove_worn_item( /* * Losing worn gear might drop hero into water or lava or onto a * location-changing trap or take away the ability to breathe in water. - * Marking it 'in_use' prevents emergency_disrobe() from dropping it. - * in_lava() appears to be ok; other cases impacting object location - * (or destruction) might still have issues. + * Marking it 'in_use' prevents emergency_disrobe() from dropping it + * and lava_effects() from destroying it; other cases impacting object + * location (or destruction) might still have issues. * * Note: if a hangup save occurs when 'in_use' is set, the item will * be destroyed via useup() during restore. Maybe remove_worn_item() diff --git a/src/trap.c b/src/trap.c index 321a38798..7c18504ac 100644 --- a/src/trap.c +++ b/src/trap.c @@ -6609,11 +6609,11 @@ lava_effects(void) for (obj = gi.invent; obj; obj = obj2) { obj2 = obj->nobj; - /* above, we set in_use for objects which are to be destroyed */ if (obj->o_id == protect_oid) { - ; /* skip protected item; caller expects to retain access */ - } else if (obj->otyp == SPE_BOOK_OF_THE_DEAD && !Blind) { - if (usurvive) + /* skip protected item; caller expects to retain access */ + obj->in_use = 1; /* was cleared when setting protect_oid */ + } else if (obj->otyp == SPE_BOOK_OF_THE_DEAD) { + if (usurvive && !Blind) pline("%s glows a strange %s, but remains intact.", The(xname(obj)), hcolor("dark red")); } else if (obj->in_use) {