github PR #896 - show contained gold for ^X

Pull request from entrez:  the '$' command got changed to show gold
in containers as well as gold in inventory.  Make ^X do the same.

Closes #896
This commit is contained in:
PatR
2022-10-12 16:28:13 -07:00
2 changed files with 30 additions and 21 deletions
+15 -7
View File
@@ -718,17 +718,25 @@ basics_enlightenment(int mode UNUSED, int final)
(u.uac < 0) ? "best" : "worst"); (u.uac < 0) ? "best" : "worst");
enl_msg("Your armor class ", "is ", "was ", buf, ""); enl_msg("Your armor class ", "is ", "was ", buf, "");
/* gold; similar to doprgold(#seegold) but without shop billing info; /* gold; similar to doprgold (#showgold) but without shop billing info;
same amount as shown on status line which ignores container contents */ includes container contents, unlike status line but like doprgold */
{ {
static const char Your_wallet[] = "Your wallet "; long umoney = money_cnt(g.invent), hmoney = hidden_gold(final);
long umoney = money_cnt(g.invent);
if (!umoney) { if (!umoney) {
enl_msg(Your_wallet, "is ", "was ", "empty", ""); Sprintf(buf, " Your wallet %s empty", !final ? "is" : "was");
} else { } else {
Sprintf(buf, "%ld %s", umoney, currency(umoney)); Sprintf(buf, " Your wallet contain%s %ld %s", !final ? "s" : "ed",
enl_msg(Your_wallet, "contains ", "contained ", buf, ""); umoney, currency(umoney));
}
Strcat(buf, hmoney ? "," : ".");
enlght_out(buf);
if (hmoney) {
Sprintf(buf, "%ld %s stashed away in your pack",
hmoney, umoney ? "more" : currency(hmoney));
enl_msg(umoney ? "and you " : "but you ", "have ", "had ", buf,
"");
} }
} }
+15 -14
View File
@@ -4496,20 +4496,21 @@ doprgold(void)
long hmoney = hidden_gold(FALSE); long hmoney = hidden_gold(FALSE);
if (Verbose(1, doprgold)) { if (Verbose(1, doprgold)) {
if (!umoney && !hmoney) char buf[BUFSZ];
Your("wallet is empty.");
else if (umoney && !hmoney) if (!umoney) {
Your("wallet contains %ld %s.", umoney, currency(umoney)); Strcpy(buf, "Your wallet is empty");
else if (!umoney && hmoney) } else {
Your("wallet is empty, but there %s %ld %s stashed away in " Sprintf(buf, "Your wallet contains %ld %s",
"your pack.", umoney, currency(umoney));
(hmoney == 1) ? "is" : "are", }
hmoney, currency(hmoney)); if (hmoney) {
else if (umoney && hmoney) Sprintf(eos(buf),
Your("wallet contains %ld %s, and there %s %ld more stashed " ", %s you have %ld %s stashed away in your pack",
"away in your pack.", umoney, currency(umoney), umoney ? "and" : "but", hmoney,
(hmoney == 1) ? "is" : "are", umoney ? "more" : currency(hmoney));
hmoney); }
pline("%s.", buf);
} else { } else {
long total = umoney + hmoney; long total = umoney + hmoney;
if (total) if (total)