diff --git a/doc/fixes37.0 b/doc/fixes37.0 index b1771ddb4..b5f68c492 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -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 diff --git a/src/invent.c b/src/invent.c index d8696c617..830d24ce7 100644 --- a/src/invent.c +++ b/src/invent.c @@ -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; }