]> granicus.if.org Git - nethack/commitdiff
more "disclose" handling
authornethack.rankin <nethack.rankin>
Tue, 20 May 2003 08:25:45 +0000 (08:25 +0000)
committernethack.rankin <nethack.rankin>
Tue, 20 May 2003 08:25:45 +0000 (08:25 +0000)
     Even though the in game help now lists the actual disclosure values
instead of "all" as the default value, implement support for "all" (also
for "none") since doing so is trivial.

doc/fixes34.2
src/options.c

index ced70b0bac3e49f35bc5852c45f3e504d5e946c0..6118f5a0bb0edaf547cdc218be3aeb24eb0b9b05 100644 (file)
@@ -69,7 +69,7 @@ provide feedback when going invisible after eating a stalker
 killer on tombstone had no prefix for starvation/exhaustion case
 ensure proper message ordering for boulder trap messages
 clean up data set by join_map that is overlaid by MAPs on special levels
-clarify disclose option default in opthelp
+clarify disclose option default in opthelp, and support "all" as old help said
 
 
 Platform- and/or Interface-Specific Fixes
index eaeae4039d4db2bab6ceca4f8c6866fd41a2a479..0c6d94f478596d43f467d0860caa2a198ccf3736 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)options.c  3.4     2003/04/30      */
+/*     SCCS Id: @(#)options.c  3.4     2003/05/19      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1681,29 +1681,28 @@ goodfruit:
                 * string as a prefix to get the desired behaviour.
                 *
                 * For backward compatibility, no prefix is required,
-                * and the presence of a i,a,g,v, or c without a
-                * prefix sets the corresponding value to DISCLOSE_YES_WITHOUT_PROMPT;
+                * and the presence of a i,a,g,v, or c without a prefix
+                * sets the corresponding value to DISCLOSE_YES_WITHOUT_PROMPT.
                 */
                boolean badopt = FALSE;
                int idx, prefix_val;
-               if (!(op = string_for_opt(opts, TRUE))) {
-                       /* for backwards compatibility, "disclose" without a
-                        * value means all (was inventory and attributes,
-                        * the only things available then), but negated
-                        * it means "none"
-                        * (note "none" contains none of "iavkgc")
-                        */
-                       for (num = 0; num < NUM_DISCLOSURE_OPTIONS; num++) {
-                               if (negated)
-                                   flags.end_disclose[num] = DISCLOSE_NO_WITHOUT_PROMPT;
-                               else flags.end_disclose[num] = DISCLOSE_PROMPT_DEFAULT_YES;
-                       }
+
+               op = string_for_opt(opts, TRUE);
+               if (op && negated) {
+                       bad_negation("disclose", TRUE);
                        return;
                }
-               if (negated) {
-                       bad_negation("disclose", TRUE);
+               /* "disclose" without a value means "all with prompting"
+                  and negated means "none without prompting" */
+               if (!op || !strcmpi(op, "all") || !strcmpi(op, "none")) {
+                       if (op && !strcmpi(op, "none")) negated = TRUE;
+                       for (num = 0; num < NUM_DISCLOSURE_OPTIONS; num++)
+                           flags.end_disclose[num] = negated ?
+                                               DISCLOSE_NO_WITHOUT_PROMPT :
+                                               DISCLOSE_PROMPT_DEFAULT_YES;
                        return;
                }
+
                num = 0;
                prefix_val = -1;
                while (*op && num < sizeof flags.end_disclose - 1) {