Have the '$' command include gold in your pack

In verbose mode, the gold in your wallet is totaled separately from
that in containers in your pack, and the two are listed separately.
In terse mode, just print the total of both.

Only known gold is mentioned.
This commit is contained in:
HMM
2021-10-18 15:04:14 -04:00
committed by Pasi Kallinen
parent b7688ca1cf
commit 706b1a939b
2 changed files with 29 additions and 6 deletions

View File

@@ -726,6 +726,7 @@ if a giant carrying a boulder was on ice that melted, it could be killed
twice, first by drowning, then by boulder filling the resulting pool
when it dropped inventory before being removed from the map
allow fire-command to automatically use a polearm, if wielding it
make '$' command also count gold carried inside containers
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -3722,14 +3722,36 @@ mergable(register struct obj *otmp, register struct obj *obj)
int
doprgold(void)
{
/* the messages used to refer to "carrying gold", but that didn't
take containers into account */
/* Command takes containers into account. */
long umoney = money_cnt(g.invent);
if (!umoney)
Your("wallet is empty.");
else
Your("wallet contains %ld %s.", umoney, currency(umoney));
/* Only list the money you know about. Guards and shopkeepers
can somehow tell if there is any gold anywhere on your
person, but you have no such preternatural gold-sense. */
long hmoney = hidden_gold(FALSE);
if (flags.verbose) {
if (!umoney && !hmoney)
Your("wallet is empty.");
else if (umoney && !hmoney)
Your("wallet contains %ld %s.", umoney, currency(umoney));
else if (!umoney && hmoney)
Your("wallet is empty, but there %s %ld %s stashed away in "
"your pack.",
(hmoney == 1) ? "is" : "are",
hmoney, currency(hmoney));
else if (umoney && hmoney)
Your("wallet contains %ld %s, and there %s %ld more stashed "
"away in your pack.", umoney, currency(umoney),
(hmoney == 1) ? "is" : "are",
hmoney);
} else {
long total = umoney + hmoney;
if (total)
You("are carrying a total of %ld %s.", total, currency(total));
else
You("have no money.");
}
shopper_financial_report();
return ECMD_OK;
}