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

Function prompt_for_player_selection

outdated/sys/wince/mswproc.c:276–640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274}
275
276void
277prompt_for_player_selection(void)
278{
279 int i, k, n;
280 char pick4u = 'n', thisch, lastch = 0;
281 char pbuf[QBUFSZ], plbuf[QBUFSZ];
282 winid win;
283 anything any;
284 menu_item *selected = 0;
285 int box_result;
286 TCHAR wbuf[BUFSZ];
287
288 logDebug("prompt_for_player_selection()\n");
289
290 /* prevent an unnecessary prompt */
291 rigid_role_checks();
292
293 /* Should we randomly pick for the player? */
294 if (!flags.randomall
295 && (flags.initrole == ROLE_NONE || flags.initrace == ROLE_NONE
296 || flags.initgend == ROLE_NONE || flags.initalign == ROLE_NONE)) {
297 /* int echoline; */
298 char *prompt = build_plselection_prompt(
299 pbuf, QBUFSZ, flags.initrole, flags.initrace, flags.initgend,
300 flags.initalign);
301
302 /* tty_putstr(BASE_WINDOW, 0, ""); */
303 /* echoline = wins[BASE_WINDOW]->cury; */
304 box_result = MessageBox(NULL, NH_A2W(prompt, wbuf, BUFSZ),
305 TEXT("NetHack for Windows"),
306#if defined(WIN_CE_SMARTPHONE)
307 MB_YESNO | MB_DEFBUTTON1
308#else
309 MB_YESNOCANCEL | MB_DEFBUTTON1
310#endif
311 );
312
313 pick4u =
314 (box_result == IDYES) ? 'y' : (box_result == IDNO) ? 'n' : '\033';
315 /* tty_putstr(BASE_WINDOW, 0, prompt); */
316 do {
317 /* pick4u = lowc(readchar()); */
318 if (strchr(quitchars, pick4u))
319 pick4u = 'y';
320 } while (!strchr(ynqchars, pick4u));
321 if ((int) strlen(prompt) + 1 < CO) {
322 /* Echo choice and move back down line */
323 /* tty_putsym(BASE_WINDOW, (int)strlen(prompt)+1, echoline,
324 * pick4u); */
325 /* tty_putstr(BASE_WINDOW, 0, ""); */
326 } else
327 /* Otherwise it's hard to tell where to echo, and things are
328 * wrapping a bit messily anyway, so (try to) make sure the next
329 * question shows up well and doesn't get wrapped at the
330 * bottom of the window.
331 */
332 /* tty_clear_nhwindow(BASE_WINDOW) */;
333

Callers 1

mswin_player_selectionFunction · 0.70

Calls 15

rigid_role_checksFunction · 0.85
build_plselection_promptFunction · 0.85
root_plselection_promptFunction · 0.85
pick_roleFunction · 0.85
randroleFunction · 0.85
ok_roleFunction · 0.85
highcFunction · 0.85
add_menuFunction · 0.85
anFunction · 0.85
select_menuFunction · 0.85
validraceFunction · 0.85
pick_raceFunction · 0.85

Tested by

no test coverage detected