Move CONWAY cleanup from the save code to goto_level to prevent a

coredump I still can't reproduce.  CONWAY_DEBUGGING is enhanced
and left enabled.
This commit is contained in:
keni
2018-01-07 17:49:14 -05:00
parent bac337fed6
commit cc5e1baf56
3 changed files with 42 additions and 9 deletions

View File

@@ -1138,6 +1138,9 @@ boolean at_stairs, falling, portal;
struct monst *mtmp;
char whynot[BUFSZ];
char *annotation;
#ifdef CONWAY
char need_late_reload_call = 0;
#endif
if (dunlev(newlevel) > dunlevs_in_dungeon(newlevel))
newlevel->dlevel = dunlevs_in_dungeon(newlevel);
@@ -1211,6 +1214,10 @@ boolean at_stairs, falling, portal;
fd = currentlevel_rewrite();
if (fd < 0)
return;
#ifdef DROPLEVEL
/* We're now committed to the level change. */
if(dropleveltempsfn) (*dropleveltempsfn)();
#endif
if (falling) /* assuming this is only trap door or hole */
impact_drop((struct obj *) 0, u.ux, u.uy, newlevel->dlevel);
@@ -1308,9 +1315,8 @@ boolean at_stairs, falling, portal;
(void) nhclose(fd);
oinit(); /* reassign level dependent obj probabilities */
#ifdef CONWAY
if(level.flags.conway){
conway_restore();
}
/* XXX move into DROPLEVEL framework? */
need_late_reload_call = 1;
#endif
}
reglyph_darkroom();
@@ -1554,6 +1560,15 @@ boolean at_stairs, falling, portal;
#ifdef INSURANCE
save_currentstate();
#endif
#ifdef CONWAY
if (need_late_reload_call){
/* This MUST be after save_currenstate() to prevent freeing
* the state table we just allocated. */
if(level.flags.conway){
conway_restore();
}
}
#endif
if ((annotation = get_annotation(&u.uz)) != 0)
You("remember this level as %s.", annotation);