]> granicus.if.org Git - nethack/commitdiff
curses: restoring via menu
authorPatR <rankin@nethack.org>
Sun, 3 Jan 2021 02:50:04 +0000 (18:50 -0800)
committerPatR <rankin@nethack.org>
Sun, 3 Jan 2021 02:50:04 +0000 (18:50 -0800)
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.

doc/fixes37.0
win/curses/cursmain.c

index 57caece1718cb13ea0c24224f380a423bc20e4e9..7193712bf2656fed9d22169db025abf49f1af035 100644 (file)
@@ -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
index b3dae7c69e9607d2f68127788a51262393e3fa74..ba738db52c591abfb3e6b70d4c2f1290b7a0f09d 100644 (file)
@@ -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);
 }