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:
@@ -1,4 +1,4 @@
|
||||
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.417 $ $NHDT-Date: 1609617569 2021/01/02 19:59:29 $
|
||||
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.418 $ $NHDT-Date: 1609642144 2021/01/03 02:49:04 $
|
||||
|
||||
General Fixes and Modified Features
|
||||
-----------------------------------
|
||||
@@ -742,6 +742,7 @@ user_sounds: provide an experimental mechanism for terminal-side sounds similar
|
||||
requires compile-time definition of TTY_SOUND_ESCCODES (also requires
|
||||
terminal-side code external to NetHack to recognize the sequence and
|
||||
act on it)
|
||||
curses: implement save file selection menu
|
||||
Qt: the "paper doll" inventory subset can be controlled via the "Qt Settings"
|
||||
dialog box ("Preferences..." on OSX)
|
||||
Qt: draw a border around each tile in the paper doll inventory; when BUC is
|
||||
|
||||
@@ -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