From cfc8599e69884f81ca13ae81f61f675b4d2c6ead Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 24 Jun 2019 15:11:51 -0700 Subject: [PATCH] fix "Bad fruit #N" warnings when saving bones savebones() sets all the fruit indices negative, then resets to the normal positive value for each fruit it actually writes into the bones file. But if 'perm_invent' is enabled and something triggers an update_inventory() while bones saving is in progress, object formatting for the inventory display won't be able to find any fruits, resulting in impossible "Bad fruit #N". Fix is to turn off 'perm_invent' when the game ends, so it won't be On when bones are written. Disclosure uses a popup for inventory so persistent window is obsolete by then anyway. [I don't know what is triggering update_inventory() while savebones() is executing. Also, I don't see where the fruits whose index stayed negative--because there aren't any on level being saved--get purged. Maybe when those bones are loaded by another game?] --- doc/fixes36.3 | 3 ++- src/end.c | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index c71dc5bb6..98a1c79f3 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.65 $ $NHDT-Date: 1561314651 2019/06/23 18:30:51 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.66 $ $NHDT-Date: 1561414302 2019/06/24 22:11:42 $ This fixes36.3 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.2 in May 2019. Please note, however, @@ -87,6 +87,7 @@ partly eaten food with one bite left had message anomalies when eaten; the wizard mode ^I menu could list "Not carrying anything" after inventory items if perm_invent option was On (even on tty where that's not supported) change #adjust to treat carrying only gold as not having anything to adjust +saving bones with 'perm_invent' On could result in "Bad fruit #N" warnings Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/src/end.c b/src/end.c index 0407f2828..8ffcd5c66 100644 --- a/src/end.c +++ b/src/end.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 end.c $NHDT-Date: 1559675615 2019/06/04 19:13:35 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.176 $ */ +/* NetHack 3.6 end.c $NHDT-Date: 1561414303 2019/06/24 22:11:43 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.178 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1044,6 +1044,12 @@ done_object_cleanup() /* placebc(); */ lift_covet_and_placebc(override_restriction); } + /* persistent inventory window now obsolete since disclosure uses + a normal popup one; avoids "Bad fruit #n" when saving bones */ + if (iflags.perm_invent) { + iflags.perm_invent = FALSE; + update_inventory(); /* make interface notice the change */ + } return; } @@ -1223,6 +1229,8 @@ int how; deal with ball and chain possibly being temporarily off the map */ if (!program_state.panicking) done_object_cleanup(); + /* in case we're panicking; normally cleared by done_object_cleanup() */ + iflags.perm_invent = FALSE; /* remember time of death here instead of having bones, rip, and topten figure it out separately and possibly getting different