From b37b9f25ce8eb0f833e577a06c8a7cf45644efa4 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 3 Apr 2020 10:41:30 -0700 Subject: [PATCH] mention_decor vs Underwater or drowning escape Avoid redundant |You are on solid land again. |You are back on floor. when walking or teleporting out of water with the mention_decor option on. --- include/flag.h | 4 +++- src/hack.c | 8 +++++--- src/pickup.c | 13 +++++++++---- src/trap.c | 1 + 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/include/flag.h b/include/flag.h index f099879d2..179eb0f0e 100644 --- a/include/flag.h +++ b/include/flag.h @@ -446,7 +446,9 @@ enum plnmsg_types { PLNMSG_CAUGHT_IN_EXPLOSION, /* explode() feedback */ PLNMSG_OBJ_GLOWS, /* "the glows " */ PLNMSG_OBJNAM_ONLY, /* xname/doname only, for #tip */ - PLNMSG_OK_DONT_DIE /* overriding death in explore/wizard mode */ + PLNMSG_OK_DONT_DIE, /* overriding death in explore/wizard mode */ + PLNMSG_BACK_ON_GROUND, /* leaving water */ + PLNMSG_enum /* allows inserting new entries with unconditional trailing comma */ }; /* runmode options */ diff --git a/src/hack.c b/src/hack.c index f8624ad6e..06b12d7e5 100644 --- a/src/hack.c +++ b/src/hack.c @@ -2106,13 +2106,15 @@ boolean newspot; /* true if called by spoteffects */ boolean still_inwater = FALSE; /* assume we're getting out */ if (!is_pool(u.ux, u.uy)) { - if (Is_waterlevel(&u.uz)) + if (Is_waterlevel(&u.uz)) { You("pop into an air bubble."); - else if (is_lava(u.ux, u.uy)) + } else if (is_lava(u.ux, u.uy)) { You("leave the %s...", hliquid("water")); /* oops! */ - else + } else { You("are on solid %s again.", is_ice(u.ux, u.uy) ? "ice" : "land"); + iflags.last_msg = PLNMSG_BACK_ON_GROUND; + } } else if (Is_waterlevel(&u.uz)) { still_inwater = TRUE; } else if (Levitation) { diff --git a/src/pickup.c b/src/pickup.c index a8b497d8f..fab94007b 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -332,10 +332,15 @@ describe_decor() if ((IS_POOL(iflags.prev_decor) || iflags.prev_decor == LAVAPOOL || iflags.prev_decor == ICE)) { - pline("%s %s %s.", - flags.verbose ? "You are back" : "Back", - (Levitation || Flying) ? "over" : "on", - surface(u.ux, u.uy)); + const char *ground = surface(u.ux, u.uy); + + if (iflags.last_msg != PLNMSG_BACK_ON_GROUND + || (strcmpi(ground, "floor") && strcmpi(ground, "ground") + && strcmpi(ground, "ice"))) + pline("%s %s %s.", + flags.verbose ? "You are back" : "Back", + (Levitation || Flying) ? "over" : "on", + ground); } } iflags.prev_decor = ltyp; diff --git a/src/trap.c b/src/trap.c index 8d84e88cd..076254ebd 100644 --- a/src/trap.c +++ b/src/trap.c @@ -5361,6 +5361,7 @@ lava_effects() pline("You're still burning."); } You("find yourself back on solid %s.", surface(u.ux, u.uy)); + iflags.last_msg = PLNMSG_BACK_ON_GROUND; return TRUE; } else if (!Wwalking && (!u.utrap || u.utraptype != TT_LAVA)) { boil_away = !Fire_resistance;