diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 941009c23..b8ab4e36a 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1075,6 +1075,8 @@ if punished and iron ball was cursed and wielded--so welded to hand--falling if player's run-time config file had OPTIONS=role:Val and the environment had NETHACKOPTIONS='role:!Val' the hero would be a Val instead of !Val sleeping or unconscious hero attacked by Medusa would meet her gaze +if a trap killed both the hero's steed and the hero an impossible "dmonsfree: + N+1 removed doesn't match N pending" warning could occur Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/hack.c b/src/hack.c index f425f8127..43a2e9027 100644 --- a/src/hack.c +++ b/src/hack.c @@ -2897,7 +2897,8 @@ spoteffects(boolean pick) : (time_left < 10L) ? 1 : 0]); } - if ((mtmp = m_at(u.ux, u.uy)) && !u.uswallow) { + + if ((mtmp = m_at(u.ux, u.uy)) != 0 && !u.uswallow) { mtmp->mundetected = mtmp->msleeping = 0; switch (mtmp->data->mlet) { case S_PIERCER: diff --git a/src/mon.c b/src/mon.c index 866abd84b..9ec08fdac 100644 --- a/src/mon.c +++ b/src/mon.c @@ -2465,6 +2465,11 @@ m_detach( mtmp->mstate |= MON_DETACH; iflags.purge_monsters++; } + + /* hero is thrown from his steed when it dies or gets genocided */ + if (mtmp == u.usteed) + dismount_steed(DISMOUNT_GENERIC); + return; } /* give a life-saved monster a reasonable mhpmax value in case it has @@ -2636,10 +2641,6 @@ mondead(struct monst *mtmp) if (mtmp->isgd && !grddead(mtmp)) return; - /* Player is thrown from his steed when it dies */ - if (mtmp == u.usteed) - dismount_steed(DISMOUNT_GENERIC); - mptr = mtmp->data; /* save this for m_detach() */ /* restore chameleon, lycanthropes to true form at death */ if (mtmp->cham >= LOW_PM) { @@ -2740,6 +2741,7 @@ mondead(struct monst *mtmp) if (glyph_is_invisible(levl[mtmp->mx][mtmp->my].glyph)) unmap_object(mtmp->mx, mtmp->my); + m_detach(mtmp, mptr); return; } @@ -2834,9 +2836,6 @@ mongone(struct monst* mdef) his temporary corridor to/from the vault has been removed */ if (mdef->isgd && !grddead(mdef)) return; - /* hero is thrown from his steed when it disappears */ - if (mdef == u.usteed) - dismount_steed(DISMOUNT_GENERIC); /* stuck to you? release */ unstuck(mdef); /* drop special items like the Amulet so that a dismissed Kop or nurse diff --git a/src/steed.c b/src/steed.c index 19b629fb3..37aaa0029 100644 --- a/src/steed.c +++ b/src/steed.c @@ -660,19 +660,12 @@ dismount_steed( /* still no spot; last resort is any spot within bounds */ (void) enexto(&steedcc, u.ux, u.uy, &mons[PM_GHOST]); } - if (!m_at(steedcc.x, steedcc.y)) { - if (mtmp->mhp < 1) /* make sure it isn't negative so that */ - mtmp->mhp = 0; /* ++mhp produces a positive value */ - mtmp->mhp++; /* force at least one hit point, possibly resurrecting - * to avoid impossible("placing defunct monst on map") */ - place_monster(mtmp, steedcc.x, steedcc.y); - mtmp->mhp--; /* take the extra hit point away: cancel resurrection - * if former steed has died */ - } else { - impossible("Dismounting: can't place former steed on map."); - } if (!DEADMONSTER(mtmp)) { + gi.in_steed_dismounting++; + place_monster(mtmp, steedcc.x, steedcc.y); + gi.in_steed_dismounting--; + /* if for bones, there's no reason to place the hero; we want to make room for potential ghost, so move steed */ if (reason == DISMOUNT_BONES) { @@ -855,7 +848,7 @@ place_monster(struct monst* mon, int x, int y) minimal_monnam(mon, TRUE), x, y, mon->mstate, buf); x = y = 0; } - if (mon == u.usteed + if ((mon == u.usteed && !gi.in_steed_dismounting) /* special case is for convoluted vault guard handling */ || (DEADMONSTER(mon) && !(mon->isgd && x == 0 && y == 0))) { describe_level(buf, 0);