MCPcopy Create free account
hub / github.com/NetHack/NetHack / ask_about_panic_save

Function ask_about_panic_save

sys/unix/unixunix.c:262–293  ·  view source on GitHub ↗

caller couldn't find a regular save file but did find a panic one */

Source from the content-addressed store, hash-verified

260
261/* caller couldn't find a regular save file but did find a panic one */
262void
263ask_about_panic_save(void)
264{
265#ifdef CHECK_PANIC_SAVE
266 static const char Instead_prompt[] = "Start a new game instead?";
267 int c = '\0';
268
269 pline("There is no regular save file but there is a panic one.");
270 pline("It might be recoverable with demi-divine intervention.");
271 if (iflags.window_inited) {
272 c = yn_function(Instead_prompt, "yn\033q", 'n', FALSE);
273 } else {
274 raw_printf("%s [yn] (n) ", Instead_prompt);
275 (void) fflush(stdout);
276 do {
277 c = getchar();
278 if (c == EOF || c == '\033' || c == '\0')
279 break;
280 c = lowc(c);
281 } while (!strchr("ynq\n", c));
282 }
283 if (c != 'y') {
284 /* caller successfully called getlock() and made <levelfile>.0 */
285 delete_levelfile(0);
286 unlock_file(HLOCK); /* just in case, release 'perm' */
287 if (iflags.window_inited)
288 exit_nhwindows((char *) 0);
289 nh_terminate(EXIT_SUCCESS);
290 }
291#endif
292 return; /* proceed with new game */
293}
294
295/* normalize file name - we don't like .'s, /'s, spaces */
296void

Callers 1

mainFunction · 0.85

Calls 8

yn_functionFunction · 0.85
fflushFunction · 0.85
delete_levelfileFunction · 0.85
unlock_fileFunction · 0.85
plineFunction · 0.50
raw_printfFunction · 0.50
lowcFunction · 0.50
nh_terminateFunction · 0.50

Tested by

no test coverage detected