segment feedback when probing long worms

When using a stethoscope or wand of probing on a long worm, report
the number of segments it has in the feedback given.

Some of the extra bhitpos and/or notonhead assigments may not be
necessary.  They were added when I was trying to figure out the
question of why probing of a tail segment revealed a long worm's
inventory even though the code explicitly prevents that.  (Answer:
it didn't; I had misinterpreted bz 12 to think that that was what
was being reported.  You need to use wand of probing--or "insigtful"
Magicbane hit--on the head in order to see its inventory or be told
"not carrying anything".)
This commit is contained in:
PatR
2016-02-26 15:16:49 -08:00
parent 0d7e51e88a
commit a00c8068f0
6 changed files with 84 additions and 37 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 pline.c $NHDT-Date: 1455672995 2016/02/17 01:36:35 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.48 $ */
/* NetHack 3.6 pline.c $NHDT-Date: 1456528597 2016/02/26 23:16:37 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.49 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -397,6 +397,22 @@ register struct monst *mtmp;
}
} else if (mtmp->mpeaceful)
Strcat(info, ", peaceful");
if (mtmp->data == &mons[PM_LONG_WORM]) {
int segndx, nsegs = count_wsegs(mtmp);
/* the worm code internals don't consider the head of be one of
the worm's segments, but we count it as such when presenting
worm feedback to the player */
if (!nsegs) {
Strcat(info, ", single segment");
} else {
++nsegs; /* include head in the segment count */
segndx = wseg_at(mtmp, bhitpos.x, bhitpos.y);
Sprintf(eos(info), ", %d%s of %d segments",
segndx, ordin(segndx), nsegs);
}
}
if (mtmp->cham >= LOW_PM && mtmp->data != &mons[mtmp->cham])
/* don't reveal the innate form (chameleon, vampire, &c),
just expose the fact that this current form isn't it */