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:
nethack.rankin
2007-04-27 02:05:28 +00:00
parent ace5a30ab5
commit 94327317c2
8 changed files with 71 additions and 15 deletions
+3
View File
@@ -118,6 +118,9 @@ pickup_burden when you pick up an item that exceeds this encumberance
or overLoaded), you will be asked if you want to continue. [S] or overLoaded), you will be asked if you want to continue. [S]
pickup_types a list of default symbols for kinds of objects to autopickup pickup_types a list of default symbols for kinds of objects to autopickup
when that option is on [all] when that option is on [all]
pile_limit for feedback when walking across floor objects, threshold at
which "there are many objects here" is displayed instead of
listing the objects. (0 means "always list objects.") [5]
runmode controls how often the map window is updated when performing runmode controls how often the map window is updated when performing
multi-step movement (various running modes or travel command): multi-step movement (various running modes or travel command):
teleport -- don't update map until movement stops; teleport -- don't update map until movement stops;
+7
View File
@@ -1983,6 +1983,13 @@ compile time option AUTOPICKUP_EXCEPTIONS included, you may be able to use
configuration file lines to further refine configuration file lines to further refine
.op autopickup .op autopickup
behavior. behavior.
.lp pile_limit
When walking across a pile of objects on the floor, threshold at which
the message "there are few/several/many objects here" is given instead
of showing a popup list of those objects. A value of 0 means "no limit"
(always list the objects); a value of 1 effectively means "never show
the objects" since the pile size will always be at least that big;
default value is 5.
.lp playmode .lp playmode
Values are `normal', `explore', or `debug'. Values are `normal', `explore', or `debug'.
Allows selection of explore mode (also known as discovery mode) or debug Allows selection of explore mode (also known as discovery mode) or debug
+9 -1
View File
@@ -31,7 +31,7 @@
\begin{document} \begin{document}
% %
% input file: guidebook.mn % input file: guidebook.mn
% $Revision: 1.103 $ $Date: 2007/02/15 05:22:32 $ % $Revision: 1.104 $ $Date: 2007/02/18 04:49:19 $
% %
%.ds h0 " %.ds h0 "
%.ds h1 %.ds h2 \% %.ds h1 %.ds h2 \%
@@ -2457,6 +2457,14 @@ compile time option AUTOPICKUP\_EXCEPTIONS included,
you may be able to use ``{\it autopickup\_exception\/}'' configuration you may be able to use ``{\it autopickup\_exception\/}'' configuration
file lines to further refine ``{\it autopickup\/}'' behavior. file lines to further refine ``{\it autopickup\/}'' behavior.
%.lp %.lp
\item[\ib{pile\_limit}]
When walking across a pile of objects on the floor, threshold at which
the message ``there are few/several/many objects here'' is given instead
of showing a popup list of those objects. A value of 0 means ``no limit''
(always list the objects); a value of 1 effectively means ``never show
the objects'' since the pile size will always be at least that big;
default value is 5.
%.lp
\item[\ib{playmode}] \item[\ib{playmode}]
Values are {\it normal\/}, {\it explore\/}, or {\it debug\/}. Values are {\it normal\/}, {\it explore\/}, or {\it debug\/}.
Allows selection of explore mode (also known as discovery mode) or debug Allows selection of explore mode (also known as discovery mode) or debug
+2
View File
@@ -323,6 +323,8 @@ player can give a monster class when asked for type of monster to poly into
likewise when asked about type for #monpolycontrol likewise when asked about type for #monpolycontrol
scroll of taming/spell of charm monster now gives some feedback scroll of taming/spell of charm monster now gives some feedback
doppelgangers can take on the shape of alternate roles' quest guardians doppelgangers can take on the shape of alternate roles' quest guardians
pile_limit option to control when to switch to "there are objects here"
vs listing objects on floor when hero goes over objects while moving
Platform- and/or Interface-Specific New Features Platform- and/or Interface-Specific New Features
+2 -1
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)flag.h 3.5 2007/02/16 */ /* SCCS Id: @(#)flag.h 3.5 2007/04/26 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -59,6 +59,7 @@ struct flag {
#define NEW_MOON 0 #define NEW_MOON 0
#define FULL_MOON 4 #define FULL_MOON 4
int pickup_burden; /* maximum burden before prompt */ int pickup_burden; /* maximum burden before prompt */
int pile_limit; /* controls feedback when walking over objects */
char inv_order[MAXOCLASSES]; char inv_order[MAXOCLASSES];
char pickup_types[MAXOCLASSES]; char pickup_types[MAXOCLASSES];
#define NUM_DISCLOSURE_OPTIONS 5 #define NUM_DISCLOSURE_OPTIONS 5
+1 -1
View File
@@ -13,7 +13,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones * Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files. * and save files.
*/ */
#define EDITLEVEL 38 #define EDITLEVEL 39
#define COPYRIGHT_BANNER_A \ #define COPYRIGHT_BANNER_A \
"NetHack, Copyright 1985-2007" "NetHack, Copyright 1985-2007"
+22 -11
View File
@@ -2336,7 +2336,7 @@ char *buf;
return dfeature; return dfeature;
} }
/* look at what is here; if there are many objects (5 or more), /* look at what is here; if there are many objects (pile_limit or more),
don't show them unless obj_cnt is 0 */ don't show them unless obj_cnt is 0 */
int int
look_here(obj_cnt, picked_some) look_here(obj_cnt, picked_some)
@@ -2349,8 +2349,11 @@ boolean picked_some;
const char *dfeature = (char *)0; const char *dfeature = (char *)0;
char fbuf[BUFSZ], fbuf2[BUFSZ]; char fbuf[BUFSZ], fbuf2[BUFSZ];
winid tmpwin; winid tmpwin;
boolean skip_objects = (obj_cnt >= 5), felt_cockatrice = FALSE; boolean skip_objects, felt_cockatrice = FALSE;
/* default pile_limit is 5; a value of 0 means "never skip"
(and 1 effectively forces "always skip") */
skip_objects = (flags.pile_limit > 0 && obj_cnt >= flags.pile_limit);
if (u.uswallow && u.ustuck) { if (u.uswallow && u.ustuck) {
struct monst *mtmp = u.ustuck; struct monst *mtmp = u.ustuck;
Sprintf(fbuf, "Contents of %s %s", Sprintf(fbuf, "Contents of %s %s",
@@ -2420,12 +2423,18 @@ boolean picked_some;
if (skip_objects) { if (skip_objects) {
if (dfeature) pline(fbuf); if (dfeature) pline(fbuf);
read_engr_at(u.ux, u.uy); /* Eric Backus */ read_engr_at(u.ux, u.uy); /* Eric Backus */
There("are %s%s objects here.", if (obj_cnt == 1 && otmp->quan == 1L)
(obj_cnt <= 10) ? "several" : "many", There("is %s object here.", picked_some ? "another" : "an");
picked_some ? " more" : ""); else
There("are %s%s objects here.",
(obj_cnt < 5) ? "a few" :
(obj_cnt < 10) ? "several" : "many",
picked_some ? " more" : "");
for ( ; otmp; otmp = otmp->nexthere) for ( ; otmp; otmp = otmp->nexthere)
if (otmp->otyp == CORPSE && will_feel_cockatrice(otmp, FALSE)) { if (otmp->otyp == CORPSE && will_feel_cockatrice(otmp, FALSE)) {
pline("Including %s%s.", pline("%s %s%s.",
(obj_cnt > 1) ? "Including" :
(otmp->quan > 1L) ? "They're" : "It's",
corpse_xname(otmp, (const char *)0, CXN_ARTICLE), corpse_xname(otmp, (const char *)0, CXN_ARTICLE),
poly_when_stoned(youmonst.data) ? "" : poly_when_stoned(youmonst.data) ? "" :
", unfortunately"); ", unfortunately");
@@ -2442,20 +2451,22 @@ boolean picked_some;
You("%s here %s.", verb, doname(otmp)); You("%s here %s.", verb, doname(otmp));
if (otmp->otyp == CORPSE) feel_cockatrice(otmp, FALSE); if (otmp->otyp == CORPSE) feel_cockatrice(otmp, FALSE);
} else { } else {
char buf[BUFSZ];
display_nhwindow(WIN_MESSAGE, FALSE); display_nhwindow(WIN_MESSAGE, FALSE);
tmpwin = create_nhwindow(NHW_MENU); tmpwin = create_nhwindow(NHW_MENU);
if(dfeature) { if(dfeature) {
putstr(tmpwin, 0, fbuf); putstr(tmpwin, 0, fbuf);
putstr(tmpwin, 0, ""); putstr(tmpwin, 0, "");
} }
putstr(tmpwin, 0, Blind ? "Things that you feel here:" : Sprintf(buf, "%s that %s here:",
"Things that are here:"); picked_some ? "Other things" : "Things",
Blind ? "you feel" : "are");
putstr(tmpwin, 0, buf);
for ( ; otmp; otmp = otmp->nexthere) { for ( ; otmp; otmp = otmp->nexthere) {
if (otmp->otyp == CORPSE && will_feel_cockatrice(otmp, FALSE)) { if (otmp->otyp == CORPSE && will_feel_cockatrice(otmp, FALSE)) {
char buf[BUFSZ];
felt_cockatrice = TRUE; felt_cockatrice = TRUE;
Strcpy(buf, doname(otmp)); Sprintf(buf, "%s...", doname(otmp));
Strcat(buf, "...");
putstr(tmpwin, 0, buf); putstr(tmpwin, 0, buf);
break; break;
} }
+25 -1
View File
@@ -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. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* 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 MENU_OPTION 4
#define TEXT_OPTION 5 #define TEXT_OPTION 5
#define PILE_LIMIT_DFLT 5
/* /*
* NOTE: If you add (or delete) an option, please update the short * NOTE: If you add (or delete) an option, please update the short
* options help (option_help()), the long options help (dat/opthelp), * options help (option_help()), the long options help (dat/opthelp),
@@ -320,6 +322,8 @@ static struct Comp_Opt
20, SET_IN_GAME }, 20, SET_IN_GAME },
{ "pickup_types", "types of objects to pick up automatically", { "pickup_types", "types of objects to pick up automatically",
MAXOCLASSES, SET_IN_GAME }, MAXOCLASSES, SET_IN_GAME },
{ "pile_limit", "threshold for \"there are many objects here\"",
24, SET_IN_GAME },
{ "playmode", { "playmode",
#ifdef WIZARD #ifdef WIZARD
"normal play, non-scoring explore mode, or debug mode", "normal play, non-scoring explore mode, or debug mode",
@@ -588,6 +592,7 @@ initoptions()
flags.end_own = FALSE; flags.end_own = FALSE;
flags.end_top = 3; flags.end_top = 3;
flags.end_around = 2; flags.end_around = 2;
flags.pile_limit = PILE_LIMIT_DFLT; /* 5 */
flags.runmode = RUN_LEAP; flags.runmode = RUN_LEAP;
iflags.msg_history = 20; iflags.msg_history = 20;
#ifdef TTY_GRAPHICS #ifdef TTY_GRAPHICS
@@ -1845,6 +1850,23 @@ goodfruit:
return; 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 */ /* play mode: normal, explore/discovery, or debug/wizard */
fullname = "playmode"; fullname = "playmode";
if (match_optname(opts, fullname, 4, TRUE)) { if (match_optname(opts, fullname, 4, TRUE)) {
@@ -3573,6 +3595,8 @@ char *buf;
oc_to_str(flags.pickup_types, ocl); oc_to_str(flags.pickup_types, ocl);
Sprintf(buf, "%s", ocl[0] ? ocl : "all" ); Sprintf(buf, "%s", ocl[0] ? ocl : "all" );
} }
else if (!strcmp(optname, "pile_limit"))
Sprintf(buf, "%d", flags.pile_limit);
else if (!strcmp(optname, "playmode")) { else if (!strcmp(optname, "playmode")) {
Strcpy(buf, Strcpy(buf,
wizard ? "debug" : discover ? "explore" : "normal"); wizard ? "debug" : discover ? "explore" : "normal");