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:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 cmd.c $NHDT-Date: 1543797825 2018/12/03 00:43:45 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.312 $ */
|
||||
/* NetHack 3.6 cmd.c $NHDT-Date: 1543972186 2018/12/05 01:09:46 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.313 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2013. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -5694,7 +5694,7 @@ dotravel(VOID_ARGS)
|
||||
cmd[1] = 0;
|
||||
cc.x = iflags.travelcc.x;
|
||||
cc.y = iflags.travelcc.y;
|
||||
if (cc.x == -1 && cc.y == -1) {
|
||||
if (cc.x == 0 && cc.y == 0) {
|
||||
/* No cached destination, start attempt from current position */
|
||||
cc.x = u.ux;
|
||||
cc.y = u.uy;
|
||||
|
||||
Reference in New Issue
Block a user