Mercurial > hg > early-roguelike
comparison 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 |
comparison
equal
deleted
inserted
replaced
84:a0d4caead33b | 85:d852b8f088c5 |
---|---|
243 | 243 |
244 initscr(); | 244 initscr(); |
245 | 245 |
246 if (slines > LINES) | 246 if (slines > LINES) |
247 { | 247 { |
248 endwin(); | |
248 printf("Sorry, original game was played on a screen with %d lines.\n",slines); | 249 printf("Sorry, original game was played on a screen with %d lines.\n",slines); |
249 printf("Current screen only has %d lines. Unable to restore game\n",LINES); | 250 printf("Current screen only has %d lines. Unable to restore game\n",LINES); |
250 return(FALSE); | 251 return(FALSE); |
251 } | 252 } |
252 | 253 |
253 if (scols > COLS) | 254 if (scols > COLS) |
254 { | 255 { |
256 endwin(); | |
255 printf("Sorry, original game was played on a screen with %d columns.\n",scols); | 257 printf("Sorry, original game was played on a screen with %d columns.\n",scols); |
256 printf("Current screen only has %d columns. Unable to restore game\n",COLS); | 258 printf("Current screen only has %d columns. Unable to restore game\n",COLS); |
257 return(FALSE); | 259 return(FALSE); |
258 } | 260 } |
259 | 261 |
274 #ifdef WIZARD | 276 #ifdef WIZARD |
275 !wizard && | 277 !wizard && |
276 #endif | 278 #endif |
277 md_unlink(file) < 0) | 279 md_unlink(file) < 0) |
278 { | 280 { |
281 endwin(); | |
279 printf("Cannot unlink file\n"); | 282 printf("Cannot unlink file\n"); |
280 return FALSE; | 283 return FALSE; |
281 } | 284 } |
282 | 285 |
283 /* | 286 /* |
286 #ifdef WIZARD | 289 #ifdef WIZARD |
287 if (!wizard) | 290 if (!wizard) |
288 #endif | 291 #endif |
289 if (sbuf2.st_nlink != 1 || syml) | 292 if (sbuf2.st_nlink != 1 || syml) |
290 { | 293 { |
294 endwin(); | |
291 printf("Cannot restore from a linked file\n"); | 295 printf("Cannot restore from a linked file\n"); |
292 return FALSE; | 296 return FALSE; |
293 } | 297 } |
298 | |
299 if (pstats.s_hpt <= 0) { | |
300 endwin(); | |
301 printf("This character is already dead.\n"); | |
302 return FALSE; | |
303 } | |
294 | 304 |
295 #ifdef SIGTSTP | 305 #ifdef SIGTSTP |
296 signal(SIGTSTP, tstp); | 306 signal(SIGTSTP, tstp); |
297 #endif | 307 #endif |
298 environ = envp; | 308 environ = envp; |