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

Function impossible

src/pline.c:583–634  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

581}
582
583void
584impossible(const char *s, ...)
585{
586 va_list the_args;
587 char pbuf[BIGBUFSZ]; /* will be chopped down to BUFSZ-1 if longer */
588 char pbuf2[BUFSZ];
589
590 va_start(the_args, s);
591 if (program_state.in_impossible)
592 panic("impossible called impossible");
593
594 program_state.in_impossible = 1;
595 (void) vsnprintf(pbuf, sizeof pbuf, s, the_args);
596 va_end(the_args);
597 pbuf[BUFSZ - 1] = '\0'; /* sanity */
598 paniclog("impossible", pbuf);
599 if (iflags.debug_fuzzer == fuzzer_impossible_panic)
600 panic("%s", pbuf);
601
602 gp.pline_flags = URGENT_MESSAGE;
603 pline("%s", pbuf);
604 gp.pline_flags = 0;
605
606 if (program_state.in_sanity_check) {
607 /* skip rest of multi-line feedback */
608 program_state.in_impossible = 0;
609 return;
610 }
611
612 Strcpy(pbuf2, "Program in disorder!");
613 if (program_state.something_worth_saving)
614 Strcat(pbuf2, " (Saving and reloading may fix this problem.)");
615 pline("%s", pbuf2);
616 pline("Please report these messages to %s.", DEVTEAM_EMAIL);
617 if (sysopt.support) {
618 pline("Alternatively, contact local support: %s", sysopt.support);
619 }
620
621#ifdef CRASHREPORT
622 if (sysopt.crashreporturl) {
623 boolean report = ('y' == yn_function("Report now?", ynchars,
624 'n', FALSE));
625
626 raw_print(""); /* prove to the user the character was accepted */
627 if (report) {
628 submit_web_report(1, "Impossible", pbuf);
629 }
630 }
631#endif
632
633 program_state.in_impossible = 0;
634}
635
636RESTORE_WARNING_FORMAT_NONLITERAL
637

Callers 15

do_mkroomFunction · 0.70
mkshopFunction · 0.70
invalid_shop_shapeFunction · 0.70
optfn_discloseFunction · 0.70
oc_to_strFunction · 0.70
set_option_mod_statusFunction · 0.70
set_wc_option_mod_statusFunction · 0.70
expulsionFunction · 0.70
quest_chatFunction · 0.70
Resists_ElemFunction · 0.70
resists_blndFunction · 0.70

Calls 6

paniclogFunction · 0.85
yn_functionFunction · 0.85
raw_printFunction · 0.85
submit_web_reportFunction · 0.85
plineFunction · 0.70
panicFunction · 0.50

Tested by

no test coverage detected