From: nethack.rankin Date: Tue, 20 May 2003 08:25:45 +0000 (+0000) Subject: more "disclose" handling X-Git-Tag: MOVE2GIT~1972 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1b512c4a492350da45da21f389afa4090c7de98d;p=nethack more "disclose" handling 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. --- diff --git a/doc/fixes34.2 b/doc/fixes34.2 index ced70b0ba..6118f5a0b 100644 --- a/doc/fixes34.2 +++ b/doc/fixes34.2 @@ -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 diff --git a/src/options.c b/src/options.c index eaeae4039..0c6d94f47 100644 --- a/src/options.c +++ b/src/options.c @@ -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) {