Fix #812: recovered stair dlevel
Stair dlevels weren't being restored with the correct values when recovered after the game crashed, apparently because they weren't being reset back to their 'absolute' level from a 'relative' level. I'm not totally sure of why this affected only recovered games (maybe that's the only time when the 'relative' stair values are used?) but this fix seems to work. Fixes #812
This commit is contained in:
@@ -749,7 +749,7 @@ dorecover(NHFILE* nhfp)
|
||||
int rtmp;
|
||||
|
||||
/* suppress map display if some part of the code tries to update that */
|
||||
g.program_state.restoring = 1;
|
||||
g.program_state.restoring = REST_GSTATE;
|
||||
|
||||
get_plname_from_file(nhfp, g.plname);
|
||||
getlev(nhfp, 0, (xint8) 0);
|
||||
@@ -776,6 +776,8 @@ dorecover(NHFILE* nhfp)
|
||||
if (rtmp < 2)
|
||||
return rtmp; /* dorecover called recursively */
|
||||
|
||||
g.program_state.restoring = REST_LEVELS;
|
||||
|
||||
/* these pointers won't be valid while we're processing the
|
||||
* other levels, but they'll be reset again by restlevelstate()
|
||||
* afterwards, and in the meantime at least u.usteed may mislead
|
||||
@@ -909,7 +911,8 @@ rest_stairs(NHFILE* nhfp)
|
||||
if (nhfp->structlevel) {
|
||||
mread(nhfp->fd, (genericptr_t) &stway, sizeof (stairway));
|
||||
}
|
||||
if (stway.tolev.dnum == u.uz.dnum) {
|
||||
if (g.program_state.restoring != REST_GSTATE
|
||||
&& stway.tolev.dnum == u.uz.dnum) {
|
||||
/* stairway dlevel is relative, make it absolute */
|
||||
stway.tolev.dlevel += u.uz.dlevel;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user