From dc6a38fe324a4c14fd8800cc7d316c54b2bb80a7 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Sun, 4 Feb 2007 04:26:35 +0000 Subject: [PATCH] fix #Q94 - quest portal bug 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 | 3 +++ src/restore.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/fixes34.4 b/doc/fixes34.4 index eeb2d2286..feaca00ff 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -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 diff --git a/src/restore.c b/src/restore.c index e5ec5e2bd..685a0ac71 100644 --- a/src/restore.c +++ b/src/restore.c @@ -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);