fix #H7667 - maybe_reset_pick(), other bad context

When deciding whether to discard interrupted lock/unlock context while
changing levels, maybe_reset_pick() checks whether xlock.box is being
carried.  But it was doing so after the old level had been saved and
memory for non-carried container there had been freed.

That led to a couple of other issues.  context.travelcc was using -1
for 'no cached value', but the fields of travelcc have type 'xchar' and
shouldn't be given negative values.  0 should be fine for 'no cache'.

Failed partial restore which occurred after old game's context had been
loaded would begin a new game with old game's stale context.  Restoring
goes out of its way to avoid that for 'flags' but didn't for 'context'.
This commit is contained in:
PatR
2018-12-04 17:10:15 -08:00
parent f6b7ce02d8
commit 36c2aec2ff
7 changed files with 39 additions and 41 deletions

View File

@@ -238,6 +238,10 @@ glowing Sting quivers if hero becomes blind and quivering Sting glows if
blindness ends; it worked for timed blindness but not for blindfold
weapon (wielded pie, egg, potion, boomerang) might be destroyed when hitting a
long worm, then freed memory was accessed to decide whether to cut it
level change after being interruped locking or unlocking a container might
access freed memory
if a restore attempt failed and a new game was started instead, it would use
stale context from old game if restoration got far enough to load that
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository