fix remaining contrived issues re HANGUPHANDLING

This commit is contained in:
nhmall
2023-03-01 12:01:43 -05:00
parent 77f241581c
commit 76e82d1312
9 changed files with 54 additions and 12 deletions

View File

@@ -164,9 +164,11 @@ main(int argc, char *argv[])
* It seems you really want to play.
*/
u.uhp = 1; /* prevent RIP on early quits */
#if defined(HANGUPHANDLING)
gp.program_state.preserve_locks = 1;
#ifndef NO_SIGNAL
sethanguphandler((SIG_RET_TYPE) hangup);
#endif
#endif
process_options(argc, argv); /* command line options */
@@ -237,7 +239,9 @@ main(int argc, char *argv[])
*/
if (*gp.plname) {
getlock();
#if defined(HANGUPHANDLING)
gp.program_state.preserve_locks = 0; /* after getlock() */
#endif
}
if (*gp.plname && (nhfp = restore_saved_game()) != 0) {

View File

@@ -74,11 +74,13 @@ eraseoldlocks(void)
{
register int i;
#if defined(HANGUPHANDLING)
gp.program_state.preserve_locks = 0; /* not required but shows intent */
/* cannot use maxledgerno() here, because we need to find a lock name
* before starting everything (including the dungeon initialization
* that sets astral_level, needed for maxledgerno()) up
*/
#endif
for (i = 1; i <= MAXDUNGEON * MAXLEVEL + 1; i++) {
/* try to remove all */
set_levelfile_name(gl.lock, i);