pile_limit option - movement feedback "there are objects here" (trunk only)
Something that pops up in the newsgroup periodically, with <Someone> inevitably pointing out the bit of code that the user needs to tweak, about control of feedback when hero is walking across floor objects. Implement new option ``pile_limit'' which allows user to set the point at which the game switches from listing the objects to giving "there are several/many objects here". Default is 5, same as previous hard-coded value (1 object gets listed via pline, 2..4 are listed in a corner popup, 5 or more objects yields a pline message instead). Setting pile_limit to 0 means no limit, so objects will always be listed regardless of pile size. Setting it to 1 effectively forces no listing since any non-empty pile size is always at least that big, so can produce "there is an object here" even though that's no briefer than a pline() to show one object.
This commit is contained in:
+25
-1
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)options.c 3.5 2007/02/14 */
|
||||
/* SCCS Id: @(#)options.c 3.5 2007/04/26 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -33,6 +33,8 @@ NEARDATA struct instance_flags iflags; /* provide linkage */
|
||||
#define MENU_OPTION 4
|
||||
#define TEXT_OPTION 5
|
||||
|
||||
#define PILE_LIMIT_DFLT 5
|
||||
|
||||
/*
|
||||
* NOTE: If you add (or delete) an option, please update the short
|
||||
* options help (option_help()), the long options help (dat/opthelp),
|
||||
@@ -320,6 +322,8 @@ static struct Comp_Opt
|
||||
20, SET_IN_GAME },
|
||||
{ "pickup_types", "types of objects to pick up automatically",
|
||||
MAXOCLASSES, SET_IN_GAME },
|
||||
{ "pile_limit", "threshold for \"there are many objects here\"",
|
||||
24, SET_IN_GAME },
|
||||
{ "playmode",
|
||||
#ifdef WIZARD
|
||||
"normal play, non-scoring explore mode, or debug mode",
|
||||
@@ -588,6 +592,7 @@ initoptions()
|
||||
flags.end_own = FALSE;
|
||||
flags.end_top = 3;
|
||||
flags.end_around = 2;
|
||||
flags.pile_limit = PILE_LIMIT_DFLT; /* 5 */
|
||||
flags.runmode = RUN_LEAP;
|
||||
iflags.msg_history = 20;
|
||||
#ifdef TTY_GRAPHICS
|
||||
@@ -1845,6 +1850,23 @@ goodfruit:
|
||||
return;
|
||||
}
|
||||
|
||||
/* pile limit: when walking over objects, number which triggers
|
||||
"there are several/many objects here" instead of listing them */
|
||||
fullname = "pile_limit";
|
||||
if (match_optname(opts, fullname, 4, TRUE)) {
|
||||
if (duplicate) complain_about_duplicate(opts, 1);
|
||||
op = string_for_opt(opts, negated);
|
||||
if ((negated && !op) || (!negated && op))
|
||||
flags.pile_limit = negated ? 0 : atoi(op);
|
||||
else if (negated)
|
||||
bad_negation(fullname, TRUE);
|
||||
else /* !op */
|
||||
flags.pile_limit = PILE_LIMIT_DFLT;
|
||||
/* sanity check */
|
||||
if (flags.pile_limit < 0) flags.pile_limit = PILE_LIMIT_DFLT;
|
||||
return;
|
||||
}
|
||||
|
||||
/* play mode: normal, explore/discovery, or debug/wizard */
|
||||
fullname = "playmode";
|
||||
if (match_optname(opts, fullname, 4, TRUE)) {
|
||||
@@ -3573,6 +3595,8 @@ char *buf;
|
||||
oc_to_str(flags.pickup_types, ocl);
|
||||
Sprintf(buf, "%s", ocl[0] ? ocl : "all" );
|
||||
}
|
||||
else if (!strcmp(optname, "pile_limit"))
|
||||
Sprintf(buf, "%d", flags.pile_limit);
|
||||
else if (!strcmp(optname, "playmode")) {
|
||||
Strcpy(buf,
|
||||
wizard ? "debug" : discover ? "explore" : "normal");
|
||||
|
||||
Reference in New Issue
Block a user