]> granicus.if.org Git - nethack/commitdiff
github pull request #235 - curses symbol set init
authorPatR <rankin@nethack.org>
Thu, 17 Oct 2019 21:38:45 +0000 (14:38 -0700)
committerPatR <rankin@nethack.org>
Thu, 17 Oct 2019 21:38:45 +0000 (14:38 -0700)
Fixes #235

For initial options under curses, specifying 'DECgraphics' as a
boolean rather than as 'symset:DECgraphics' wasn't overriding the
new default 'symset:curses'.  Since previously DECgraphics was
rejected for curses, it's possible that no one noticed.

include/rm.h
src/drawing.c
src/files.c
src/options.c
win/curses/cursinit.c

index de1c8cfda5d5d90fb0956412f4332b62dc026d86..87d7566a2f261f01266cf317aed2067444090b64 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 rm.h    $NHDT-Date: 1571313651 2019/10/17 12:00:51 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.63 $ */
+/* NetHack 3.6 rm.h    $NHDT-Date: 1571347960 2019/10/17 21:32:40 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.64 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Pasi Kallinen, 2017. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -278,7 +278,7 @@ struct symsetentry {
     Bitfield(nocolor, 1);     /* don't use color if set               */
     Bitfield(primary, 1);     /* restricted for use as primary set    */
     Bitfield(rogue, 1);       /* restricted for use as rogue lev set  */
-    Bitfield(fallback, 1);    /* no explicit symset set               */
+    Bitfield(explicitly, 1);  /* explicit symset set                  */
                               /* 4 free bits */
 };
 
index 2ac8ad28e7c17d55a2e4a3fe82361367d196fca2..072485fb6c9b0c79f30b2968ab3219bd0d0fa268 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 drawing.c       $NHDT-Date: 1571313651 2019/10/17 12:00:51 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.61 $ */
+/* NetHack 3.6 drawing.c       $NHDT-Date: 1571347973 2019/10/17 21:32:53 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.62 $ */
 /* Copyright (c) NetHack Development Team 1992.                   */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -548,7 +548,6 @@ boolean name_too;
     /* initialize restriction bits */
     symset[which_set].primary = 0;
     symset[which_set].rogue = 0;
-    symset[which_set].fallback = TRUE;
 
     if (name_too) {
         if (symset[which_set].name)
index f9d2dee8e8eaf640b8af087302faf929649c63d4..77b2790773d007775a92efe1e6816bf240098780 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 files.c $NHDT-Date: 1571313652 2019/10/17 12:00:52 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.253 $ */
+/* NetHack 3.6 files.c $NHDT-Date: 1571347976 2019/10/17 21:32:56 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.254 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Derek S. Ray, 2015. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -3168,9 +3168,11 @@ int which_set;
 {
     FILE *fp;
 
+    symset[which_set].explicitly = FALSE;
     if (!(fp = fopen_sym_file()))
         return 0;
 
+    symset[which_set].explicitly = TRUE;
     symset_count = 0;
     chosen_symset_start = chosen_symset_end = FALSE;
     symset_which_set = which_set;
@@ -3190,7 +3192,14 @@ int which_set;
                 || !strcmpi(symset[which_set].name, "default")))
             clear_symsetentry(which_set, TRUE);
         config_error_done();
-        return (symset[which_set].name == 0) ? 1 : 0;
+
+        /* If name was defined, it was invalid... Then we're loading fallback */
+        if (symset[which_set].name) {
+            symset[which_set].explicitly = FALSE;
+            return 0;
+        }
+
+        return 1;
     }
     if (!chosen_symset_end)
         config_error_add("Missing finish for symset \"%s\"",
index 019a4544fef8e14a86505e87ab9c6db9ca1ba862..ddbe794f8c2db2579cae8f410c61157ffc9e6295 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 options.c       $NHDT-Date: 1571313653 2019/10/17 12:00:53 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.378 $ */
+/* NetHack 3.6 options.c       $NHDT-Date: 1571347977 2019/10/17 21:32:57 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.379 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Michael Allison, 2008. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -2315,7 +2315,6 @@ boolean tinitial, tfrom_file;
             } else {
                 if (!initial && Is_rogue_level(&u.uz))
                     assign_graphics(ROGUESET);
-                symset[ROGUESET].fallback = FALSE;
                 need_redraw = TRUE;
             }
         } else
@@ -2340,7 +2339,6 @@ boolean tinitial, tfrom_file;
                 return FALSE;
             } else {
                 switch_symbols(symset[PRIMARY].name != (char *) 0);
-                symset[PRIMARY].fallback = FALSE;
                 need_redraw = TRUE;
             }
         } else
@@ -6061,10 +6059,8 @@ int which_set;
 
     if (read_sym_file(which_set)) {
         switch_symbols(TRUE);
-        symset[which_set].fallback = FALSE;
     } else {
         clear_symsetentry(which_set, TRUE);
-        symset[which_set].fallback = TRUE;
         return 0;
     }
     return 1;
index e5a74128b93cff1c8b7b842cd20f446a171ccbb8..3d4f977d65446f1513cfe1ae4f4829b5b2ad0323 100644 (file)
@@ -785,9 +785,9 @@ curses_init_options()
     set_option_mod_status("eight_bit_tty", SET_IN_FILE);
 
     /* If we don't have a symset defined, load the curses symset by default */
-    if (symset[PRIMARY].fallback)
+    if (!symset[PRIMARY].explicitly)
         load_symset("curses", PRIMARY);
-    if (symset[ROGUESET].fallback)
+    if (!symset[ROGUESET].explicitly)
         load_symset("default", ROGUESET);
 
 #ifdef PDCURSES