unix check_panic_save

Inspired by self-recover, sort of.  Enabled for unix by default; can
be disabled by commenting out '#define CHECK_PANIC_SAVE' in unixconf.h.

When starting the game, if there is no save file to restore and no
lock/level files to recover, check whether a panic save file exists.
If there is one, tell the player that it's there and that it might be
viable, then ask whether to start a new game.

It doesn't convert the panic save into a reconverable one (rename by
nethack, then continue trying to restore) or tell the player how to
make it viable (rename to remove ".e" by game admin), just whether it
is present.  If player opts to start a new game, the panic save is
left alone and will trigger the "there's a panic save file" situation
again once the new game finishes and player starts another.
This commit is contained in:
PatR
2024-03-23 10:11:35 -07:00
parent 4d206c1c40
commit ef17c7ac2b
5 changed files with 129 additions and 16 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 unixmain.c $NHDT-Date: 1708737183 2024/02/24 01:13:03 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.126 $ */
/* NetHack 3.7 unixmain.c $NHDT-Date: 1711213891 2024/03/23 17:11:31 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.127 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -305,6 +305,16 @@ main(int argc, char *argv[])
goto attempt_restore;
}
}
#ifdef CHECK_PANIC_SAVE
/* no save file; check for a panic save; if the check finds one,
ask the player whether to proceed with a new game; it will
quit instead of returning if the answer isn't yes */
if (check_panic_save())
ask_about_panic_save();
#endif
/* no save file; start a new game */
newgame();
wd_message();
}