]> granicus.if.org Git - nethack/commitdiff
fix pull request #526 - 'menucolor' help message
authorPatR <rankin@nethack.org>
Sat, 5 Jun 2021 22:17:55 +0000 (15:17 -0700)
committerPatR <rankin@nethack.org>
Sat, 5 Jun 2021 22:17:55 +0000 (15:17 -0700)
being given when it shouldn't be.  A change for perm_invent handling
back in March screwed up the if/then/else logic for code executed
when finishing MENUCOLOR manipulation via the 'O' command.  That
resulted in the reminder to set menucolors to True being given even
when it was already True if perm_invent happened to be False.

I noticed this myself recently, then neglected to investigate it or
even write it down anywhere.

Fixes #526

doc/fixes37.0
src/options.c

index 1cad986810e015de23a2bbc8c3b5d4bd6a973b85..0af4b1b2483c7b614d1d730a3e41f83d3d6ab806 100644 (file)
@@ -702,6 +702,9 @@ applying a book to check readability treated novels as if they were spellbooks
        error (example was an attempt to interactively set bouldersym to an
        invalid value), the error reporting routine crashed via segfault
 lighting for baalz level defaulted to random and could end up being lit
+when using 'O' to set menu color patterns, the reminder message that the
+       boolean menucolors option needs to be set to True for them to work
+       was sometimes given even when already True
 
 curses: 'msg_window' option wasn't functional for curses unless the binary
        also included tty support
index d04ab4ac437326ad37dcf795a3bb654dae3eaeec..f18433db03a4335cc108f630e4a1499fd5e71dd2 100644 (file)
@@ -5049,14 +5049,16 @@ handler_menu_colors(void)
            inventory window; we don't track whether an actual changed
            occurred, so just assume there was one and that it matters;
            if we're wrong, a redundant update is cheap... */
-        if (iflags.use_menu_color && iflags.perm_invent)
-            update_inventory();
+        if (iflags.use_menu_color) {
+            if (iflags.perm_invent)
+                update_inventory();
 
-        /* menu colors aren't being used; if any are defined, remind
-           player how to use them */
-        else if (nmc > 0)
+        /* menu colors aren't being used yet; if any MENUCOLOR rules are
+           defined, remind player how to activate them */
+        } else if (nmc > 0) {
             pline(
     "To have menu colors become active, toggle 'menucolors' option to True.");
+        }
         return optn_ok;
 
     } else if (opt_idx == 0) { /* add new */