From 0532eae7d200927afb1f2bd61aee2dbc045675bd Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 27 Mar 2023 17:08:18 -0700 Subject: [PATCH] feedback when escaping lava Fix the duplicate feedback given when landing on one or more items after teleporting out of lava. This also avoids "you find yourself back on solid water" if you are able to survive at a water location and safe_teleds() puts you on one. --- doc/fixes3-7-0.txt | 2 ++ src/hack.c | 4 ++++ src/trap.c | 32 ++++++++++++++++++++++++++++---- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index e27cff8fc..025eedc9b 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1127,6 +1127,8 @@ having worn levitation boots removed and destroyed (scroll, monster spell, yielded "object lost" panic if program had been built with a debugging malloc implementation which overwrites the contents of freed memory ensure that all window interfaces respect flags.silent (suppress terminal beep) +falling into lava, being life-saved, and teleporting out could yield redundant + descriptions of what was present at hero's new location Fixes to 3.7.0-x General Problems Exposed Via git Repository diff --git a/src/hack.c b/src/hack.c index e7fa66225..d0a81ddab 100644 --- a/src/hack.c +++ b/src/hack.c @@ -2852,6 +2852,10 @@ spoteffects(boolean pick) /* or transformed trap (land mine -> pit) */ && (!spottrap || !trap || trap->ttyp == spottraptyp)) return; + /* when float_down() puts hero into lava and she teleports out, + defer spoteffects() until after "you are back on solid " */ + if (iflags.in_lava_effects) + return; ++inspoteffects; spotterrain = levl[u.ux][u.uy].typ; diff --git a/src/trap.c b/src/trap.c index 698cdd50b..aaac11b49 100644 --- a/src/trap.c +++ b/src/trap.c @@ -6140,8 +6140,6 @@ lava_effects(void) } } - iflags.in_lava_effects--; - /* s/he died... */ boil_away = (u.umonnum == PM_WATER_ELEMENTAL || u.umonnum == PM_STEAM_VORTEX @@ -6160,8 +6158,34 @@ lava_effects(void) /* nowhere safe to land; repeat burning loop */ pline("You're still burning."); } - You("find yourself back on solid %s.", surface(u.ux, u.uy)); - iflags.last_msg = PLNMSG_BACK_ON_GROUND; + + iflags.in_lava_effects--; + + /* + * 3.7: this used to be uncondtional "back on solid " + * but surface() could return a lot of things where that ends up + * sounding silly. Deal with water, ignore furniture; assume + * surface types 'air' and 'cloud' won't be present on same level + * as lava so don't need to be catered for. + * + * Made it out of the lava. We know that hero isn't levitating + * or flying but life-saving plus fireproof water walking boots + * (and no fire resistance) could put hero on water rather than + * "on solid ground"; likewise if poly'd into an aquatic form. + */ + if (is_pool(u.ux, u.uy)) + You("find yourself %s %s.", u.uinwater ? "in" : "on", + hliquid("water")); + else + You("find yourself back on solid %s.", surface(u.ux, u.uy)); + iflags.last_msg = PLNMSG_BACK_ON_GROUND; /* for describe_decor(); + * use for on-water too */ + /* surface() just disclosed this */ + iflags.prev_decor = gl.lastseentyp[u.ux][u.uy] = levl[u.ux][u.uy].typ; + /* normally done via safe_teleds() -> teleds() -> spoteffects() but + spoteffects() was no-op when called with nonzero in_lava_effects */ + spoteffects(FALSE); /* suppress auto-pickup for this landing... */ + return TRUE; } else if (!Wwalking && (!u.utrap || u.utraptype != TT_LAVA)) { boil_away = !Fire_resistance;