]> granicus.if.org Git - nethack/commitdiff
fix #Q94 - quest portal bug
authornethack.rankin <nethack.rankin>
Sun, 4 Feb 2007 04:26:35 +0000 (04:26 +0000)
committernethack.rankin <nethack.rankin>
Sun, 4 Feb 2007 04:26:35 +0000 (04:26 +0000)
     From a bug report.  (Michael forwarded a newsgroup posting about it back
then, but I had trouble reproducing it and didn't figure it out until
trying again now.)  If hangup occurred while entering the quest, the magic
portal could be rendered inactive for the hero but still work for monsters.
That's because the hangup save stored the old value of u.uz0 before
goto_level set it to the new u.uz, and a magic portal won't operate when
u.uz0 differs from u.uz (to prevent a pair of portals from getting stuck
sending the hero back and forth).  The problem could also occur going from
the quest back to the dungeon, or either direction for Ft.Ludios, but the
--More-- prompt when the quest entry text is being displayed makes hangup
during level change most likely to occur during initial quest entry.

     This is just a bandaid, and the SAFERHANGUP config wouldn't be hit
by this situation.

doc/fixes34.4
src/restore.c

index eeb2d228625e6ec08e82af7a031fb95d98e7cfd4..feaca00ff3a6754064921c03887618dbc382dd96 100644 (file)
@@ -299,6 +299,9 @@ attempting to kick beyond map edge performed an out of array bounds memory
        access; symptom seen was "show_glyph: bad pos" warning when blind
 attempting to engrave with an empty wand should always use a turn
 don't access freed memory after engraving "wrests one last charnge" from wand
+a magic portal could be rendered inactive for the hero if a successful
+       hangup save took place during level change; leaving the level by any
+       means other than triggering the portal would reactivate it
 
 
 Platform- and/or Interface-Specific Fixes
index e5ec5e2bdd38d0612289126662f44fc5a6617d3f..685a0ac716cf328c0b46671a42c6969f9ae52dcf 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)restore.c  3.5     2007/01/11      */
+/*     SCCS Id: @(#)restore.c  3.5     2007/02/03      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -562,6 +562,8 @@ unsigned int *stuckid, *steedid;    /* STEED */
            u.uz.dlevel = 1;
            return(FALSE);
        }
+       /* in case hangup save occurred in midst of level change */
+       assign_level(&u.uz0, &u.uz);
 
        /* this stuff comes after potential aborted restore attempts */
        restore_killers(fd);