fix #H348 - "you trip over it" after non-"it" message (trunk only)

Reported to us by <email deleted>:
  'You are beginning to feel hungry.  You trip over it.'
and also recently in the newsgroup by "<Someone>":
  There is ice here.  *You see here an electric eel corpse.*
  Bib hits the electric eel.  Bib misses the electric eel.
  Bib misses the electric eel.  The electric eel misses Bib.
  The electric eel misses Bib.  *You trip over it.*

     slip_or_trip() was oversimplifying things by assuming that if there
is one object at the hero's location, a message about what that object is
has just been given.  Any timeout message which precedes Fumbling (lots
of candiates besides hunger) could intervene, as could monster activity
between the hero's move and timeout handling.  Aside from the reported
cases, that code hadn't been updated to account for the new pile_limit
option which could be set to 1 and force a popup display instead of the
usual "you see <an item> here".  This fix adds a flag that can be used
to track the most recent message.  It is cleared by pline for every
message, so pline's caller sets it _after_ the message of interest has
been displayed.
This commit is contained in:
nethack.rankin
2007-06-10 03:01:31 +00:00
parent 8dbbd1d2d0
commit 283b681072
6 changed files with 16 additions and 3 deletions

View File

@@ -656,7 +656,7 @@ STATIC_OVL void
slip_or_trip()
{
struct obj *otmp = vobj_at(u.ux, u.uy);
const char *what, *pronoun;
const char *what;
char buf[BUFSZ];
boolean on_foot = TRUE;
#ifdef STEED
@@ -673,8 +673,8 @@ slip_or_trip()
name; if not, look for rocks to trip over; trip over
anonymous "something" if there aren't any rocks.
*/
pronoun = otmp->quan == 1L ? "it" : Hallucination ? "they" : "them";
what = !otmp->nexthere ? pronoun :
what = (iflags.last_msg == PLNMSG_ONE_ITEM_HERE) ?
((otmp->quan == 1L) ? "it" : Hallucination ? "they" : "them") :
(otmp->dknown || !Blind) ? doname(otmp) :
((otmp = sobj_at(ROCK, u.ux, u.uy)) == 0 ? something :
(otmp->quan == 1L ? "a rock" : "some rocks"));