]> granicus.if.org Git - nethack/commitdiff
monsters moving after player leaves level
authorPatR <rankin@nethack.org>
Fri, 30 Oct 2015 01:18:12 +0000 (18:18 -0700)
committerPatR <rankin@nethack.org>
Fri, 30 Oct 2015 01:18:12 +0000 (18:18 -0700)
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.

doc/fixes36.0
src/mon.c

index 5dcc50fec3dcfe3470c6b5c191e3db5ca78fc192..913310ebde7d31db1822b368ffb08181c22c2fe9 100644 (file)
@@ -386,7 +386,7 @@ meditating monsters stop meditating when affected by something which wakes
 monsters capable of hiding can't do so when trapped or while holding you
 limit recursive calls to spoteffects (poly'd hero fell into water, reverted
        to human because of it, fell into same water, then crawled out twice)
-ensure that the punishment ball and chain make it into the save file after being
+ensure that the punishment ball and chain make it into save file after being
        temporarily orphaned from the normal chains in the swallowing code
 display the invisible monster glyph ('I') whenever an unseen monster forces
        poly'd hero out of hiding
@@ -812,7 +812,7 @@ autosearch finds and transforms secret doors and corridors even while blind,
 fix message typo, "you sold some items inside <container> for N gold piecess"
 hangup save made during magic mapping or <foo> detection performed while
        underwater could put hero on top of the water after restore
-fix bug preventing stone-resistant monsters w/o gloves from wielding cockatrices
+fix bug preventing stone-resistant monster w/o gloves from wielding cockatrice
 items conferring life drain resistance were affected by drain life spell
 'a'pply command could be used to recognize undiscovered potions of oil
 fix replacing an existing bones file in wizard mode [load?y, unlink?n, die?y,
@@ -907,11 +907,11 @@ when commands (D, A, object identify) mix object class filtering with BUCX
        blessed scrolls rather than all scrolls plus blessed everything)
 bmask is stored with the objects on the Plane of Water to prevent segfault
 engraving on drawbridge with wand of digging should produce appropriate
-    message instead of referring to gravel
+       message instead of referring to gravel
 engraving Elbereth is less efficient as protection
 scare monster scroll now provides a better effect
 monsters without hands can no longer pick up piles of objects (with 
-    certain exceptions)
+       certain exceptions)
 uncursed enchant weapon now correctly fixes erosion
 scroll of earth messages cleaned up
 long worms can no longer be leashed
@@ -926,6 +926,9 @@ flesh golems hit by electricity healed by wrong amount
 fleeing monsters couldn't use stairs that lead to different dungeon branch
 casting spell of protection when previous casting(s) hadn't time out yet
        miscalculated the new AC increment
+remaining monsters continued to move after hero conceptually left the level
+       when a monster knocked him onto a level-changing trap (this bug made
+       it be feasible--but not practical--to level teleport with the Amulet)
 
 
 Platform- and/or Interface-Specific Fixes
index 060cd46b7adef7280927be8c1ba07b0b1899629e..4b2154ec0846c7f41fec25b4bf98ec387ced5d83 100644 (file)
--- a/src/mon.c
+++ b/src/mon.c
@@ -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 */