]> granicus.if.org Git - nethack/commitdiff
granular verbose message suppression mechanics updated
authornhmall <nhmall@nethack.org>
Thu, 9 Jun 2022 19:16:28 +0000 (15:16 -0400)
committernhmall <nhmall@nethack.org>
Thu, 9 Jun 2022 19:16:28 +0000 (15:16 -0400)
update the macro definition

[re-do full commit message due to errors in last one]

Switch to using a macro invocation Verbos(n, s) in place of the
flags.verbose checks.

Provide the mechanics for individual suppression of any of the
existing messages that were considered verbose.

Mechanics only - this code update does not provide any means of
setting the suppression bits.

flags.verbose = 0
is still a master suppression of all the verbose messages.

flags.verbose = 1
turns on the verbose messages only for those whose suppression
bit is 0 (not set).

include/hack.h

index 740df08e6413e07c2a9f3c49ba3f964d48a0d49b..2b276606bfd0e66111f0342b4b00fc445fdfe556 100644 (file)
@@ -862,8 +862,10 @@ enum verbosity_values {
 #undef VB_ELEMENTS
 extern long verbosity_suppressions[vb_elements];   /* in decl.c */
 
-#define Verbose(n,s) (flags.verbose && ((n) < vb_elements) \
-                      && !(verbosity_suppressions[(n)] & vb##n##s))
+#define Verbose(n,s) (flags.verbose && \
+    (((n) >= 0 && (n) < vb_elements) && \
+        !(verbosity_suppressions[(n)] & vb##n##s)))
+
 #else       /* NO_VERBOSE_GRANULARITY */
 #define Verbose(n,s) (flags.verbose)
 #endif      /* !NO_VERBOSE_GRANULARITY */