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

Function curses_askname

win/curses/cursmain.c:316–343  ·  view source on GitHub ↗

Ask the user for a player name. */

Source from the content-addressed store, hash-verified

314
315/* Ask the user for a player name. */
316void
317curses_askname(void)
318{
319#ifdef SELECTSAVED
320 if (iflags.wc2_selectsaved && !iflags.renameinprogress)
321 switch (restore_menu(MAP_WIN)) {
322 case -1: /* quit */
323 goto bail;
324 case 0: /* new game */
325 break;
326 case 1: /* picked a save file to restore and set plname[] for it */
327 return;
328 }
329#endif /* SELECTSAVED */
330
331 curses_line_input_dialog("Who are you?", svp.plname, PL_NSIZ);
332 (void) mungspaces(svp.plname);
333 if (!svp.plname[0] || svp.plname[0] == '\033')
334 goto bail;
335
336 iflags.renameallowed = TRUE; /* tty uses this, we don't [yet?] */
337 return;
338
339 bail:
340 /* message is delivered via raw_print() */
341 curses_bail("\nUntil next time then...\n");
342 /*NOTREACHED*/
343}
344
345
346/* Does window event processing (e.g. exposure events).

Callers

nothing calls this directly

Calls 4

restore_menuFunction · 0.85
curses_line_input_dialogFunction · 0.85
mungspacesFunction · 0.85
curses_bailFunction · 0.85

Tested by

no test coverage detected