fix #K4189 - dorecover() bug

Restoring was hiding unhidden mimics and if that chose an object
other than boulder of gold pieces, it called mkobj() before an
array used by that routine was initialized.  The result was warning
"rnd(0) attempted" when NH_DEVEL_STATUS wasn't set to 'released' or
divide by 0 crash if it was set to that.

Restore should not be catching up for lost time when unpacking a
save file into individual level files, and if it hadn't done that
it wouldn't hide mimics who aren't currently hidden.

In addition to avoiding that, this also moves the initialization of
the offending mkobj array sooner.

[3.6 didn't use that array so wasn't susceptible to this.  It is
hiding unhidden mimics during what should be a strictly bookkeeping
operation though.]
This commit is contained in:
PatR
2024-06-08 13:34:12 -07:00
parent d02028fe66
commit d7008f8fe5
3 changed files with 19 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1442 $ $NHDT-Date: 1717570484 2024/06/05 06:54:44 $
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1443 $ $NHDT-Date: 1717878584 2024/06/08 20:29:44 $
General Fixes and Modified Features
-----------------------------------
@@ -1954,6 +1954,8 @@ on medusa-4, Medusa and the downstairs were located in different chambers
on medusa-3 and medusa-4, Perseus's statue was located in a different chamber
from Medusa
omit "a" from "drowned in a limitless water" when drowning on Plane of Water
restoring a save file could trigger impossible "rnd(0) attempted" if it tried
to make an unhidden mimic hide an an object
Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository