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 hack.c $NHDT-Date: 1540591769 2018/10/26 22:09:29 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.194 $ */
|
||||
/* NetHack 3.6 hack.c $NHDT-Date: 1543972190 2018/12/05 01:09:50 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.200 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Derek S. Ray, 2015. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -923,7 +923,7 @@ int mode;
|
||||
u.dx = u.tx - u.ux;
|
||||
u.dy = u.ty - u.uy;
|
||||
nomul(0);
|
||||
iflags.travelcc.x = iflags.travelcc.y = -1;
|
||||
iflags.travelcc.x = iflags.travelcc.y = 0;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1045,7 +1045,7 @@ int mode;
|
||||
nomul(0);
|
||||
/* reset run so domove run checks work */
|
||||
context.run = 8;
|
||||
iflags.travelcc.x = iflags.travelcc.y = -1;
|
||||
iflags.travelcc.x = iflags.travelcc.y = 0;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user