sequencing issue: dismounting from dying steed
Reported by entrez: if a trap killed hero's steed and dismounting
was fatal for the hero (probably by falling onto the same trap),
impossible "dmonsfree: 1 removed doesn't match 0 pending" warning
occurred during game-over cleanup.
Move the dismount calls in mondead() and mongone() from before their
m_detach() call to the end of m_detach() itself. This led to a
cascade of problems and attempted fixes until finally zeroing in on
place_monster()'s sanity checks and dismount_steed()'s attempts to
work-around one of them.
This reverts the convoluted hack from four years ago in commit
be327d9822 and deals with the issue in
a simpler way. After that, the new dismount_steed() placement at
end of m_detach() works cleanly.
This commit is contained in:
13
src/mon.c
13
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
|
||||
|
||||
Reference in New Issue
Block a user