extern void done1(int);
extern int done2(void);
extern void done_in_by(struct monst *, int);
+extern void done_object_cleanup(void);
#endif /* !MAKEDEFS_C && MDLIB_C */
extern void panic(const char *, ...) PRINTF_F(1, 2) NORETURN;
#if !defined(MAKEDEFS_C) && !defined(MDLIB_C)
static void disclose(int, boolean);
static void get_valuables(struct obj *);
static void sort_valuables(struct valuable_data *, int);
-static void done_object_cleanup(void);
static void artifact_score(struct obj *, boolean, winid);
static void really_done(int) NORETURN;
static void savelife(int);
#endif
/* deal with some objects which may be in an abnormal state at end of game */
-static void
+void
done_object_cleanup(void)
{
int ox, oy;
u.uinwater = 1, iflags.save_uinwater = 0; /* bypass set_uinwater() */
if (iflags.save_uburied)
u.uburied = 1, iflags.save_uburied = 0;
+ /* extra handling for hangup save or panic save; without this,
+ a thrown light source might trigger an "obj_is_local" panic;
+ if a thrown or kicked object is in transit, put it on the map;
+ when punished, make sure ball and chain are placed too */
+ done_object_cleanup(); /* maybe force some items onto map */
if (!g.program_state.something_worth_saving || !g.SAVEF[0])
goto done;
#endif
void
-savelev(NHFILE* nhfp, xchar lev)
+savelev(NHFILE *nhfp, xchar lev)
{
#ifdef TOS
short tlev;
if (nhfp->mode == FREEING) /* see above */
goto skip_lots;
- savelevl(nhfp,
- (boolean) ((sfsaveinfo.sfi1 & SFI1_RLECOMP) == SFI1_RLECOMP));
+ savelevl(nhfp, ((sfsaveinfo.sfi1 & SFI1_RLECOMP) == SFI1_RLECOMP));
if (nhfp->structlevel) {
bwrite(nhfp->fd, (genericptr_t) g.lastseentyp, sizeof g.lastseentyp);
bwrite(nhfp->fd, (genericptr_t) &g.moves, sizeof g.moves);
return;
}
+/* free a lot of allocated memory which is ordinarily freed during save */
void
freedynamicdata(void)
{
dmonsfree(); /* release dead monsters */
/* level-specific data */
+ done_object_cleanup(); /* maybe force some OBJ_FREE items onto map */
free_current_level();
/* game-state data [ought to reorganize savegamestate() to handle this] */