Mercurial > hg > early-roguelike
diff rogue4/save.c @ 85:d852b8f088c5
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.
author | John "Elwin" Edwards |
---|---|
date | Fri, 09 Aug 2013 09:34:07 -0700 |
parents | a0d4caead33b |
children | ee250e3646fd |
line wrap: on
line diff
--- 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