monsters moving after player leaves level

Fix the problem reported by ais where it was possible for one monster
to knock the hero onto a level teleporter (or trapdoor or hole),
destination was selected and allowed-to-level-teleport checks were made,
then for another monster to knock or teleport the not-yet-relocated-hero
onto the Amulet and have auto-pickup move it into inventory.  At the end
of that turn's monster movement, hero would level teleport successfully
despite carrying the Amulet.

This short-circuits monster movement if the hero is scheduled to be
moved to a different level.  The monsters who haven't moved yet don't
lose their pending movement points; they'll catch up if/when the hero
returns to the level.
This commit is contained in:
PatR
2015-10-29 18:18:12 -07:00
parent 9008ba321b
commit 41a40d41a0
2 changed files with 14 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mon.c $NHDT-Date: 1445556873 2015/10/22 23:34:33 $ $NHDT-Branch: master $:$NHDT-Revision: 1.192 $ */
/* NetHack 3.6 mon.c $NHDT-Date: 1446166647 2015/10/30 00:57:27 $ $NHDT-Branch: master $:$NHDT-Revision: 1.193 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -631,12 +631,16 @@ movemon()
*/
for (mtmp = fmon; mtmp; mtmp = nmtmp) {
/* end monster movement early if hero is flagged to leave the level */
if (u.utotype
#ifdef SAFERHANGUP
if (program_state.done_hup) {
/* or if the program has lost contact with the user */
|| program_state.done_hup
#endif
) {
somebody_can_move = FALSE;
break;
}
#endif
nmtmp = mtmp->nmon;
/* one dead monster needs to perform a move after death:
vault guard whose temporary corridor is still on the map */