# HG changeset patch # User John "Elwin" Edwards # Date 1376066047 25200 # Node ID d852b8f088c5c9ffe8438bc87a2b2445b999f779 # Parent a0d4caead33b988f69c6af4d0ef50b60ae1c6bfd Refuse to restore if the character is dead. This prevents recovering from death by killing the game between death and exit, producing an automatic save. diff -r a0d4caead33b -r d852b8f088c5 arogue5/save.c --- a/arogue5/save.c Thu Aug 08 14:30:12 2013 -0700 +++ b/arogue5/save.c Fri Aug 09 09:34:07 2013 -0700 @@ -245,6 +245,12 @@ } } + if (pstats.s_hpt <= 0) { + endwin(); + printf("This character is already dead.\n"); + return FALSE; + } + environ = envp; strcpy(file_name, file); setup(); diff -r a0d4caead33b -r d852b8f088c5 rogue3/save.c --- a/rogue3/save.c Thu Aug 08 14:30:12 2013 -0700 +++ b/rogue3/save.c Fri Aug 09 09:34:07 2013 -0700 @@ -234,6 +234,12 @@ return FALSE; } + if (pstats.s_hpt <= 0) { + endwin(); + printf("This character is already dead.\n"); + return FALSE; + } + environ = envp; strcpy(file_name, file); setup(); diff -r a0d4caead33b -r d852b8f088c5 rogue4/save.c --- a/rogue4/save.c Thu Aug 08 14:30:12 2013 -0700 +++ b/rogue4/save.c Fri Aug 09 09:34:07 2013 -0700 @@ -245,6 +245,7 @@ if (slines > LINES) { + endwin(); printf("Sorry, original game was played on a screen with %d lines.\n",slines); printf("Current screen only has %d lines. Unable to restore game\n",LINES); return(FALSE); @@ -252,6 +253,7 @@ if (scols > COLS) { + endwin(); printf("Sorry, original game was played on a screen with %d columns.\n",scols); printf("Current screen only has %d columns. Unable to restore game\n",COLS); return(FALSE); @@ -276,6 +278,7 @@ #endif md_unlink(file) < 0) { + endwin(); printf("Cannot unlink file\n"); return FALSE; } @@ -288,10 +291,17 @@ #endif if (sbuf2.st_nlink != 1 || syml) { + endwin(); printf("Cannot restore from a linked file\n"); return FALSE; } + if (pstats.s_hpt <= 0) { + endwin(); + printf("This character is already dead.\n"); + return FALSE; + } + #ifdef SIGTSTP signal(SIGTSTP, tstp); #endif diff -r a0d4caead33b -r d852b8f088c5 srogue/save.c --- a/srogue/save.c Thu Aug 08 14:30:12 2013 -0700 +++ b/srogue/save.c Fri Aug 09 09:34:07 2013 -0700 @@ -342,6 +342,12 @@ } + if (him->s_hpt <= 0) { + endwin(); + printf("This character is already dead.\n"); + return FALSE; + } + environ = envp; strcpy(file_name, file);