fix #K4063 - "back on ground" given at odd time

Moving over at item that's resting on ice gives a message about there
being ice present and then about the item, whether mention_decor is On
or Off.  With it On, you'll get a message about being back on solid
ground as soon as you leave the ice.  With it Off you wouldn't get
that at all if not levitating; that's the basic no-mention_decor
behavior for ice.  However, if you were levitating, you would get a
delayed "back on solid ground" message when moving over some other
object, which might occur quite a bit later.  Autopickup handling is
calling describe_decor() when the hero is levitating and some of that
wasn't appropriate for no-mention_decor.

This issue has been present since I first implemented mention_decor,
not introduced by recent back_on_ground() changes.
This commit is contained in:
PatR
2023-12-13 13:15:18 -08:00
parent d4c0f6bb75
commit 9d3710163e
5 changed files with 36 additions and 19 deletions

View File

@@ -1801,6 +1801,10 @@ add 'X' as a potential context-sensitive item-action for uwep and uswapwep
monsters weren't noticing hero's possession or lack of magic resistance when monsters weren't noticing hero's possession or lack of magic resistance when
hero getting zapped by a wand of striking was or wasn't resisted hero getting zapped by a wand of striking was or wasn't resisted
discard monsters' observations about hero's resistances when saving bones discard monsters' observations about hero's resistances when saving bones
autopickup while levitating shares code with 'mention_decor'; after being told
about ice covered by an object, moving over some other object later
when mention_decor is Off could give "you are back on solid ground"
long after leaving the ice
Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository

View File

@@ -2831,7 +2831,6 @@ pooleffects(
You("leave the %s...", hliquid("water")); /* oops! */ You("leave the %s...", hliquid("water")); /* oops! */
} else { } else {
back_on_ground(FALSE); back_on_ground(FALSE);
iflags.last_msg = PLNMSG_BACK_ON_GROUND;
} }
} else if (Is_waterlevel(&u.uz)) { } else if (Is_waterlevel(&u.uz)) {
still_inwater = TRUE; still_inwater = TRUE;

View File

@@ -299,14 +299,16 @@ void
force_decor(boolean via_probing) force_decor(boolean via_probing)
{ {
/* we don't want describe_decor() to defer feedback if hero is fumbling /* we don't want describe_decor() to defer feedback if hero is fumbling
with 1 turn left, or for ice_descr() to skip thawing details if hero with 1 turn left until next slip_or_trip(), or for ice_descr() to
is probing when levitating while blind (those will be skipped for omit thawing details if hero is probing when levitating while blind
look_here() and farlook() or autodescribe); we can't control that by (those will be skipped for look_here() and farlook() or autodescribe);
temporarily tweaking properties because that could become noticeable we can't control that by temporarily tweaking properties because that
if status gets updated while decor feedback is being delivered */ could become noticeable if status gets updated while decor feedback
is being delivered */
gd.decor_fumble_override = TRUE; gd.decor_fumble_override = TRUE;
gd.decor_levitate_override = via_probing; gd.decor_levitate_override = via_probing;
/* force current terrain to be different from previous location */ /* force current terrain to be different from previous location, or
uninteresting if previous location was actually inside solid stone */
iflags.prev_decor = STONE; iflags.prev_decor = STONE;
(void) describe_decor(); (void) describe_decor();
gd.decor_fumble_override = gd.decor_levitate_override = FALSE; gd.decor_fumble_override = gd.decor_levitate_override = FALSE;
@@ -314,9 +316,12 @@ force_decor(boolean via_probing)
} }
void void
deferred_decor(boolean setup) /* True: deferring, False: catching up */ deferred_decor(
boolean setup) /* True: deferring, False: catching up */
{ {
if (setup) { if (!flags.mention_decor) {
iflags.defer_decor = FALSE;
} else if (setup) {
iflags.defer_decor = TRUE; iflags.defer_decor = TRUE;
} else { } else {
(void) describe_decor(); (void) describe_decor();
@@ -334,14 +339,17 @@ describe_decor(void)
const char *dfeature; const char *dfeature;
int ltyp; int ltyp;
if ((HFumbling & TIMEOUT) == 1L && !iflags.defer_decor if ((HFumbling & TIMEOUT) == 1L /* about to slip_or_trip */
&& !iflags.defer_decor
&& !gd.decor_fumble_override) { /* probe_decor() */ && !gd.decor_fumble_override) { /* probe_decor() */
/* /*
* Work around a message sequencing issue: avoid * Work around a message sequencing issue if Fumbling's periodic
* timeout is about to kick in: avoid the combination
* |You are back on floor. * |You are back on floor.
* |You trip over <object>. or You flounder. * |You trip over <object>. or You flounder.
* when the trip is being caused by moving on ice as hero * when the trip is being caused by moving on ice as hero
* steps off ice onto non-ice. * steps off ice onto non-ice. Defer the back-on-floor part if
* that is about to happen.
*/ */
deferred_decor(TRUE); deferred_decor(TRUE);
return FALSE; return FALSE;
@@ -378,7 +386,7 @@ describe_decor(void)
Strcpy(fbuf, dfeature); Strcpy(fbuf, dfeature);
Sprintf(outbuf, "%s.", upstart(fbuf)); Sprintf(outbuf, "%s.", upstart(fbuf));
} }
if (ltyp == ICE) if (ltyp == ICE && flags.mention_decor)
Norep("%s", outbuf); Norep("%s", outbuf);
else else
pline("%s", outbuf); pline("%s", outbuf);
@@ -391,7 +399,11 @@ describe_decor(void)
} }
} }
} }
iflags.prev_decor = ltyp; /* describe_decor() is normally called when moving onto a different
type of terrain, but it is also called by pickup() even when
mention_decor is Off if hero can't reach floor; only adapt the next
describe_decor() by what has just occurred in this one when it's On */
iflags.prev_decor = flags.mention_decor ? ltyp : STONE;
return res; return res;
} }

View File

@@ -1138,9 +1138,7 @@ slip_or_trip(void)
struct obj *otmp = vobj_at(u.ux, u.uy), *otmp2; struct obj *otmp = vobj_at(u.ux, u.uy), *otmp2;
const char *what; const char *what;
char buf[BUFSZ]; char buf[BUFSZ];
boolean on_foot = TRUE; boolean on_foot = !u.usteed;
if (u.usteed)
on_foot = FALSE;
if (otmp && on_foot && !u.uinwater && is_pool(u.ux, u.uy)) if (otmp && on_foot && !u.uinwater && is_pool(u.ux, u.uy))
otmp = 0; otmp = 0;
@@ -1179,11 +1177,14 @@ slip_or_trip(void)
/* is fumbling from ice alone? */ /* is fumbling from ice alone? */
boolean ice_only = !(EFumbling || (HFumbling & ~FROMOUTSIDE)); boolean ice_only = !(EFumbling || (HFumbling & ~FROMOUTSIDE));
pline("%s %s%s on the ice.", pline("%s %s%s %s the ice.",
u.usteed ? upstart(x_monnam(u.usteed, ARTICLE_THE, (char *) 0, u.usteed ? upstart(x_monnam(u.usteed, ARTICLE_THE, (char *) 0,
SUPPRESS_SADDLE, FALSE)) SUPPRESS_SADDLE, FALSE))
: "You", : "You",
rn2(2) ? "slip" : "slide", on_foot ? "" : "s"); rn2(2) ? "slip" : "slide", on_foot ? "" : "s",
/* sometimes slipping due to ice occurs during turn that hero
has just moved off the ice; phrase things differently then */
is_ice(u.ux, u.uy) ? "on" : "off");
/* fumbling outside of ice while mounted always causes the hero to /* fumbling outside of ice while mounted always causes the hero to
fall from the saddle, so to avoid a counterintuitive effect where fall from the saddle, so to avoid a counterintuitive effect where
ice makes riding _less_ hazardous, unconditionally dismount if ice makes riding _less_ hazardous, unconditionally dismount if

View File

@@ -4728,6 +4728,7 @@ back_on_ground(boolean rescued)
you_are_back = flags.verbose ? "You are back" : "Back"; you_are_back = flags.verbose ? "You are back" : "Back";
} }
pline("%s %s %s.", you_are_back, preposit, surf); pline("%s %s %s.", you_are_back, preposit, surf);
iflags.last_msg = PLNMSG_BACK_ON_GROUND;
} }
/* life-saving or divine rescue has attempted to get the hero out of hostile /* life-saving or divine rescue has attempted to get the hero out of hostile