'showscore' vs containers

When SCORE_ON_BOTL is enabled, you could tell how much gold is
inside a container with unknown contents by having 'showsore' On
and watching how much the score changed on the status line when
picking the container up.
This commit is contained in:
PatR
2020-11-21 17:37:01 -08:00
parent d48e730700
commit 3e9d8f9aa5
10 changed files with 47 additions and 41 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 vault.c $NHDT-Date: 1596498223 2020/08/03 23:43:43 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.76 $ */
/* NetHack 3.7 vault.c $NHDT-Date: 1606009006 2020/11/22 01:36:46 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.77 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -249,7 +249,7 @@ struct monst *grd;
}
/* if carrying gold and arriving anywhere other than next to the guard,
set the guard loose */
if ((money_cnt(g.invent) || hidden_gold())
if ((money_cnt(g.invent) || hidden_gold(TRUE))
&& um_dist(grd->mx, grd->my, 1)) {
if (grd->mpeaceful) {
if (canspotmon(grd)) /* see or sense via telepathy */
@@ -487,7 +487,7 @@ invault()
else
verbalize("I don't know you.");
umoney = money_cnt(g.invent);
if (!umoney && !hidden_gold()) {
if (!umoney && !hidden_gold(TRUE)) {
if (Deaf)
pline("%s stomps%s.", noit_Monnam(guard),
(Blind) ? "" : " and beckons");
@@ -795,7 +795,7 @@ register struct monst *grd;
}
umoney = money_cnt(g.invent);
u_carry_gold = umoney > 0L || hidden_gold() > 0L;
u_carry_gold = (umoney > 0L || hidden_gold(TRUE) > 0L);
if (egrd->fcend == 1) {
if (u_in_vault && (u_carry_gold || um_dist(grd->mx, grd->my, 1))) {
if (egrd->warncnt == 3 && !Deaf)
@@ -1107,15 +1107,17 @@ boolean silently;
return;
}
/* amount of gold in carried containers */
long
hidden_gold()
hidden_gold(even_if_unknown)
boolean even_if_unknown; /* True: all gold; False: limit to known contents */
{
long value = 0L;
struct obj *obj;
for (obj = g.invent; obj; obj = obj->nobj)
if (Has_contents(obj))
value += contained_gold(obj);
if (Has_contents(obj) && (obj->cknown || even_if_unknown))
value += contained_gold(obj, even_if_unknown);
/* unknown gold stuck inside statues may cause some consternation... */
return value;