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

Function askQuit

outdated/sys/mac/macmenu.c:1104–1152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1102}
1103
1104static void
1105askQuit()
1106{
1107 Boolean doQuit = 1;
1108 Boolean doYes = 0;
1109 Boolean winMac;
1110 char *quitinput;
1111
1112 if (!strcmp(windowprocs.name, "mac"))
1113 winMac = 1;
1114 else
1115 winMac = 0;
1116
1117 if (theMenubar < mbarRegular) {
1118 short itemHit;
1119
1120 ParamText("\pReally Quit?", "\p", "\p", "\p");
1121 itemHit = Alert(alrtMenu_NY, (ModalFilterUPP) 0L);
1122 ResetAlertStage();
1123
1124 if (itemHit != bttnMenuAlertYes) {
1125 doQuit = 0;
1126 } else {
1127 doYes = 1;
1128 }
1129 }
1130 if (doQuit) {
1131 /* MWM -- forgive me lord, an even uglier kludge to deal with
1132 differences
1133 in command input handling
1134 */
1135 if (winMac)
1136 quitinput = "#quit\r";
1137 else
1138 quitinput = "#q\r";
1139
1140 /* KMH -- Ugly kludge */
1141 while (*quitinput)
1142 AddToKeyQueue(*quitinput++, 1);
1143 if (doYes) {
1144 if (winMac)
1145 quitinput = "y\rq\r\r\r";
1146 else
1147 quitinput = "yq\r";
1148 while (*quitinput)
1149 AddToKeyQueue(*quitinput++, 1);
1150 }
1151 }
1152}

Callers 1

DoMenuEvtFunction · 0.85

Calls 1

AddToKeyQueueFunction · 0.85

Tested by

no test coverage detected