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.
This commit is contained in:
nethack.rankin
2003-05-20 08:25:45 +00:00
parent 459cee350e
commit 1b512c4a49
2 changed files with 18 additions and 19 deletions

View 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

View 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;
}
return;
}
if (negated) {
op = string_for_opt(opts, TRUE);
if (op && negated) {
bad_negation("disclose", TRUE);
return;
}
/* "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) {