From: PatR Date: Sat, 30 Apr 2022 06:00:51 +0000 (-0700) Subject: avoid new "where are we?" panic X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=140077b163bd824f4b4fdc3c3ead9ba4a3dca45b;p=nethack avoid new "where are we?" panic savelev() gets run to clean up memory even if the player quits before level 1 is created, and a change made yesterday panicked if it couldn't figure out what level the hero is on. Caught by entrez, again.... If not actually writing a level's file, don't panic if both u.uz and g.uz_save are 0. Having one of those be non-zero is only essential when the level being processed is the Plane of Water or Plane of Air. --- diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 6d4fa18a3..ee2bcf2c7 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1,4 +1,4 @@ -HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.902 $ $NHDT-Date: 1651297020 2022/04/30 05:37:00 $ +HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.903 $ $NHDT-Date: 1651298443 2022/04/30 06:00:43 $ General Fixes and Modified Features ----------------------------------- @@ -1196,6 +1196,7 @@ force-fight against furniture covered by an object described the attack as using #wizmakemap on Plane of Water added a new set of air bubbles each time it was run and eventually replaced just about all the water; likewise with clouds on Plane of Air +avoid new "where are we?" panic if player quits during character selection curses: 'msg_window' option wasn't functional for curses unless the binary also included tty support diff --git a/src/save.c b/src/save.c index 89516275a..d0354573a 100644 --- a/src/save.c +++ b/src/save.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 save.c $NHDT-Date: 1644524061 2022/02/10 20:14:21 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.181 $ */ +/* NetHack 3.7 save.c $NHDT-Date: 1651298444 2022/04/30 06:00:44 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.186 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2009. */ /* NetHack may be freely redistributed. See license for details. */ @@ -463,8 +463,10 @@ savelev(NHFILE *nhfp, xchar lev) boolean set_uz_save = (g.uz_save.dnum == 0 && g.uz_save.dlevel == 0); /* caller might have already set up g.uz_save and zeroed u.uz; - if not, we need to set it for save_bubbles() */ - if (set_uz_save) { + if not, we need to set it for save_bubbles(); caveat: if the + player quits during character selection, u.uz won't be set yet + but we'll be called during run-down */ + if (set_uz_save && perform_bwrite(nhfp)) { if (u.uz.dnum == 0 && u.uz.dlevel == 0) { g.program_state.something_worth_saving = 0; panic("savelev: where are we?");