curses: restoring via menu
Clone the tty SELECTSAVED code in curses. If you would be getting the "who are you?" prompt (perhaps via 'nethack -u player') and you have at least one save file, you'll get a menu of save files (plus entries for 'new game' and 'quit') to choose from. Requires '#define SELECTDSAVED' at build time (only ntconf.h does that by default) and when present, can be disabled by setting 'selectsaved' to False in NETHACKOPTIONS or .nethackrc.
This commit is contained in:
@@ -40,13 +40,16 @@ struct window_procs curses_procs = {
|
||||
#endif
|
||||
| WC_PERM_INVENT | WC_POPUP_DIALOG | WC_SPLASH_SCREEN),
|
||||
(WC2_DARKGRAY | WC2_HITPOINTBAR
|
||||
#ifdef SELECTSAVED
|
||||
| WC2_SELECTSAVED
|
||||
#endif
|
||||
#if defined(STATUS_HILITES)
|
||||
| WC2_HILITE_STATUS
|
||||
#endif
|
||||
| WC2_FLUSH_STATUS | WC2_TERM_SIZE
|
||||
| WC2_STATUSLINES | WC2_WINDOWBORDERS | WC2_PETATTR | WC2_GUICOLOR
|
||||
| WC2_SUPPRESS_HIST),
|
||||
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */
|
||||
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */
|
||||
curses_init_nhwindows,
|
||||
curses_player_selection,
|
||||
curses_askname,
|
||||
@@ -237,6 +240,19 @@ curses_player_selection()
|
||||
void
|
||||
curses_askname()
|
||||
{
|
||||
#ifdef SELECTSAVED
|
||||
if (iflags.wc2_selectsaved && !iflags.renameinprogress)
|
||||
switch (restore_menu(MAP_WIN)) {
|
||||
case -1:
|
||||
curses_bail("Until next time then..."); /* quit */
|
||||
/*NOTREACHED*/
|
||||
case 0:
|
||||
break; /* no game chosen; start new game */
|
||||
case 1:
|
||||
return; /* g.plname[] has been set */
|
||||
}
|
||||
#endif /* SELECTSAVED */
|
||||
|
||||
g.plname[0] = '\0';
|
||||
curses_line_input_dialog("Who are you?", g.plname, PL_NSIZ);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user