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

Function done2

src/end.c:89–148  ·  view source on GitHub ↗

"#quit" command or keyboard interrupt */

Source from the content-addressed store, hash-verified

87
88/* "#quit" command or keyboard interrupt */
89int
90done2(void)
91{
92 boolean abandon_tutorial = FALSE;
93
94 if (In_tutorial(&u.uz)
95 && y_n("Switch from the tutorial back to regular play?") == 'y')
96 abandon_tutorial = TRUE;
97
98 if (abandon_tutorial || !paranoid_query(
99 ParanoidQuit, "Really quit without saving?")) {
100#ifndef NO_SIGNAL
101 (void) signal(SIGINT, (SIG_RET_TYPE) done1);
102#endif
103 clear_nhwindow(WIN_MESSAGE);
104 curs_on_u();
105 wait_synch();
106 if (gm.multi > 0)
107 nomul(0);
108 if (gm.multi == 0) {
109 u.uinvulnerable = FALSE; /* avoid ctrl-C bug -dlc */
110 u.usleep = 0;
111 }
112
113 if (abandon_tutorial)
114 schedule_goto(&u.ucamefrom, UTOTYPE_ATSTAIRS,
115 "Resuming regular play.", (char *) 0);
116 return ECMD_OK;
117 }
118
119#if (defined(UNIX) || defined(VMS) || defined(LATTICE))
120 if (wizard) {
121 int c;
122#ifdef VMS
123 extern int debuggable; /* sys/vms/vmsmisc.c, vmsunix.c */
124
125 c = !debuggable ? 'n' : ynq("Enter debugger?");
126#else
127#ifdef LATTICE
128 c = ynq("Create SnapShot?");
129#else
130 c = ynq("Dump core?");
131#endif
132#endif
133 if (c == 'y') {
134#ifndef NO_SIGNAL
135 (void) signal(SIGINT, (SIG_RET_TYPE) done1);
136#endif
137 if (soundprocs.sound_exit_nhsound)
138 (*soundprocs.sound_exit_nhsound)("done2");
139
140 exit_nhwindows((char *) 0);
141 NH_abort(NULL);
142 } else if (c == 'q')
143 done_stopprint++;
144 }
145#endif
146 done(QUIT);

Callers 3

onWMCommandFunction · 0.85
done1Function · 0.85
onWMCommandFunction · 0.85

Calls 7

paranoid_queryFunction · 0.85
curs_on_uFunction · 0.85
wait_synchFunction · 0.85
nomulFunction · 0.85
schedule_gotoFunction · 0.85
NH_abortFunction · 0.85
doneFunction · 0.85

Tested by

no test coverage detected