petrified engulfer (display glitch & potential panic)

From the newsgroup:  if you were polymorped into a cockatrice and
a trapper attempted to swallow you, the 't' displayed at its location
would be left behind after it turned to stoned.  This fixes that and a
much more serious issue as well:  if you were punished at the time, the
game would panic on your next attempt to move because the ball&chain were
left in limbo.  There would also have been strangeness (monster sharing
your location, stale u.ustuck setting) if the swallower was life-saved,
but I didn't try to make that happen so am not sure how bad things would
have been.
This commit is contained in:
nethack.rankin
2004-10-28 03:16:24 +00:00
parent 1f21a5c6f2
commit e723710c82
2 changed files with 18 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)mhitu.c 3.4 2004/06/12 */
/* SCCS Id: @(#)mhitu.c 3.4 2004/10/27 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1629,13 +1629,15 @@ gulpmu(mtmp, mattk) /* monster swallows you, or damage if u.uswallow */
boolean physical_damage = FALSE;
if (!u.uswallow) { /* swallows you */
int omx = mtmp->mx, omy = mtmp->my;
if (youmonst.data->msize >= MZ_HUGE) return(0);
if ((t && ((t->ttyp == PIT) || (t->ttyp == SPIKED_PIT))) &&
sobj_at(BOULDER, u.ux, u.uy))
return(0);
if (Punished) unplacebc(); /* ball&chain go away */
remove_monster(mtmp->mx, mtmp->my);
remove_monster(omx, omy);
mtmp->mtrapped = 0; /* no longer on old trap */
place_monster(mtmp, u.ux, u.uy);
u.ustuck = mtmp;
@@ -1671,9 +1673,16 @@ gulpmu(mtmp, mattk) /* monster swallows you, or damage if u.uswallow */
}
if (touch_petrifies(youmonst.data) && !resists_ston(mtmp)) {
minstapetrify(mtmp, TRUE);
if (mtmp->mhp > 0) return 0;
else return 2;
/* put the attacker back where it started;
the resulting statue will end up there */
remove_monster(mtmp->mx, mtmp->my); /* u.ux,u.uy */
place_monster(mtmp, omx, omy);
minstapetrify(mtmp, TRUE);
/* normally unstuck() would do this, but we're not
fully swallowed yet so that won't work here */
if (Punished) placebc();
u.ustuck = 0;
return (mtmp->mhp > 0) ? 0 : 2;
}
display_nhwindow(WIN_MESSAGE, FALSE);