MCPcopy Index your code
hub / github.com/NetHack/NetHack / VA_DECL

Function VA_DECL

src/end.c:393–471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391
392/*VARARGS1*/
393ATTRNORETURN void
394panic VA_DECL(const char *, str)
395{
396 char buf[BUFSZ];
397 VA_START(str);
398 VA_INIT(str, char *);
399
400 if (program_state.panicking++)
401 NH_abort(NULL); /* avoid loops - this should never happen*/
402
403 gb.bot_disabled = TRUE;
404 if (iflags.window_inited) {
405 raw_print("\r\nOops...");
406 wait_synch(); /* make sure all pending output gets flushed */
407 if (soundprocs.sound_exit_nhsound)
408 (*soundprocs.sound_exit_nhsound)("panic");
409 exit_nhwindows((char *) 0);
410 iflags.window_inited = FALSE; /* they're gone; force raw_print()ing */
411 }
412
413 raw_print(program_state.gameover
414 ? "Postgame wrapup disrupted."
415 : !program_state.something_worth_saving
416 ? "Program initialization has failed."
417 : "Suddenly, the dungeon collapses.");
418#ifndef MICRO
419#ifdef NOTIFY_NETHACK_BUGS
420 if (!wizard)
421 raw_printf("Report the following error to \"%s\" or at \"%s\".",
422 DEVTEAM_EMAIL, DEVTEAM_URL);
423 else if (program_state.something_worth_saving)
424 raw_print("\nError save file being written.\n");
425#else /* !NOTIFY_NETHACK_BUGS */
426 if (!wizard) {
427 const char *maybe_rebuild = !program_state.something_worth_saving
428 ? "."
429 : "\nand it may be possible to rebuild.";
430
431// XXX this may need an update if defined(CRASHREPORT) TBD
432 if (sysopt.support)
433 raw_printf("To report this error, %s%s", sysopt.support,
434 maybe_rebuild);
435 else if (sysopt.fmtd_wizard_list) /* formatted SYSCF WIZARDS */
436 raw_printf("To report this error, contact %s%s",
437 sysopt.fmtd_wizard_list, maybe_rebuild);
438 else
439 raw_printf("Report error to \"%s\"%s", WIZARD_NAME,
440 maybe_rebuild);
441 }
442#endif /* ?NOTIFY_NETHACK_BUGS */
443 /* XXX can we move this above the prints? Then we'd be able to
444 * suppress "it may be possible to rebuild" based on dosave0()
445 * or say it's NOT possible to rebuild. */
446 if (program_state.something_worth_saving && !iflags.debug_fuzzer) {
447 set_error_savefile();
448 if (dosave0()) {
449 /* os/win port specific recover instructions */
450 if (sysopt.recover)

Callers

nothing calls this directly

Calls 9

NH_abortFunction · 0.85
raw_printFunction · 0.85
wait_synchFunction · 0.85
set_error_savefileFunction · 0.85
dosave0Function · 0.85
paniclogFunction · 0.85
interjectFunction · 0.85
really_doneFunction · 0.85
raw_printfFunction · 0.70

Tested by

no test coverage detected