move 'g.restoring' to 'g.program_state.restoring'
Move the core's global restoring flag (not the same as main()'s local resuming flag) to a more logical place. Add a saving flag in the process, but it isn't being set or cleared anywhere yet. (Once in use it will probably fix the exception during save that was just reported, but before that it would be useful to figure out what specifically caused the event.) The program_state struct really ought to be standalone rather than part of struct g but I haven't made that change. Removing an unused variable for wishing and some reformatting that whent along with it got mixed in. Removes some trailing whitespace in sfstruct.c too. Only lightly tested...
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 restore.c $NHDT-Date: 1605305492 2020/11/13 22:11:32 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.171 $ */
|
||||
/* NetHack 3.7 restore.c $NHDT-Date: 1606765214 2020/11/30 19:40:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.173 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Michael Allison, 2009. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -643,9 +643,9 @@ unsigned int *stuckid, *steedid;
|
||||
while (bc_obj) {
|
||||
struct obj *nobj = bc_obj->nobj;
|
||||
|
||||
bc_obj->nobj = (struct obj *) 0;
|
||||
if (bc_obj->owornmask)
|
||||
setworn(bc_obj, bc_obj->owornmask);
|
||||
bc_obj->nobj = (struct obj *) 0;
|
||||
bc_obj = nobj;
|
||||
}
|
||||
g.migrating_objs = restobjchn(nhfp, FALSE);
|
||||
@@ -771,7 +771,7 @@ NHFILE *nhfp;
|
||||
int rtmp;
|
||||
struct obj *otmp;
|
||||
|
||||
g.restoring = TRUE;
|
||||
g.program_state.restoring = 1;
|
||||
get_plname_from_file(nhfp, g.plname);
|
||||
getlev(nhfp, 0, (xchar) 0);
|
||||
if (!restgamestate(nhfp, &stuckid, &steedid)) {
|
||||
@@ -786,7 +786,7 @@ NHFILE *nhfp;
|
||||
is not really affiliated with an open file */
|
||||
close_nhfile(nhfp);
|
||||
(void) delete_savefile();
|
||||
g.restoring = FALSE;
|
||||
g.program_state.restoring = 0;
|
||||
return 0;
|
||||
}
|
||||
restlevelstate(stuckid, steedid);
|
||||
@@ -895,8 +895,8 @@ NHFILE *nhfp;
|
||||
g.vision_full_recalc = 1; /* recompute vision (not saved) */
|
||||
|
||||
run_timers(); /* expire all timers that have gone off while away */
|
||||
g.program_state.restoring = 0; /* affects bot() so clear before docrt() */
|
||||
docrt();
|
||||
g.restoring = FALSE;
|
||||
clear_nhwindow(WIN_MESSAGE);
|
||||
|
||||
/* Success! */
|
||||
|
||||
Reference in New Issue
Block a user