fix stone-to-flesh on petrified long worm

montraits() didn't have any handling for long worm tails, makemon()
didn't have any provision for creating a long worm without a tail,
replmon() uses place_wegs() to put tail segments on the map when
replacing a dummy new monster with the mtraits one but place_wsegs()
wasn't updating the head segment since it isn't put on the map.

That turned out to be key because there is always an extra segment
co-located with the monster and when its coordinates were wrong,
worm_known() gave bad results for visibility checking.  The
statue-goes-away message was the one for not being able to see the
monster that it just animated into, even though 'w' appeared at the
spot.  It took quite a while to track down what was going on there.

Sanity checking for worms has been updated and could conceivably
start triggering complaints about things that it used ignore.
This commit is contained in:
PatR
2020-06-03 03:00:13 -07:00
parent 503df6823d
commit bb566e8a04
6 changed files with 79 additions and 47 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 makemon.c $NHDT-Date: 1590879611 2020/05/30 23:00:11 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.172 $ */
/* NetHack 3.6 makemon.c $NHDT-Date: 1591178397 2020/06/03 09:59:57 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.173 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1124,10 +1124,11 @@ long mmflags;
struct monst fakemon;
coord cc;
int mndx, mcham, ct, mitem;
boolean anymon = (!ptr);
boolean byyou = (x == u.ux && y == u.uy);
boolean allow_minvent = ((mmflags & NO_MINVENT) == 0);
boolean countbirth = ((mmflags & MM_NOCOUNTBIRTH) == 0);
boolean anymon = !ptr,
byyou = (x == u.ux && y == u.uy),
allow_minvent = ((mmflags & NO_MINVENT) == 0),
countbirth = ((mmflags & MM_NOCOUNTBIRTH) == 0),
allowtail = ((mmflags & MM_NOTAIL) == 0);
unsigned gpflags = (mmflags & MM_IGNOREWATER) ? MM_IGNOREWATER : 0;
fakemon = cg.zeromonst;
@@ -1348,7 +1349,7 @@ long mmflags;
mtmp->mpeaceful = mtmp->mtame = FALSE;
}
if (mndx == PM_LONG_WORM && (mtmp->wormno = get_wormno()) != 0) {
initworm(mtmp, rn2(5));
initworm(mtmp, allowtail ? rn2(5) : 0);
if (count_wsegs(mtmp))
place_worm_tail_randomly(mtmp, x, y);
}