The word "zorkmid" was hard-coded in format strings all

over the place.

Often they would use
	"%ld zorkmid%s", amt, plur(amt)
but not consistently, so some of the hard-coded usage
could result in "1 zorkmids"

This adds the function
	currency(long)
to return the name of the currency, either plural
or singular depending on the argument passed to it.
That eliminates the need for the extra %s in the
format string and the use of the plur() macro.
This commit is contained in:
nethack.allison
2002-01-21 03:35:04 +00:00
parent 4f10682592
commit f2fe0a3d5c
12 changed files with 100 additions and 89 deletions

View File

@@ -573,6 +573,14 @@ register int type;
return((struct obj *) 0);
}
const char *
currency(amount)
long amount;
{
if (amount == 1) return "zorkmid";
else return "zorkmids";
}
boolean
have_lizard()
{
@@ -1442,9 +1450,9 @@ long quan; /* if non-0, print this quantity, not obj->quan */
*/
if (cost != 0 || let == '*') {
/* if dot is true, we're doing Iu, otherwise Ix */
Sprintf(li, "%c - %-45s %6ld zorkmid%s",
Sprintf(li, "%c - %-45s %6ld %s",
(dot && use_invlet ? obj->invlet : let),
(txt ? txt : doname(obj)), cost, plur(cost));
(txt ? txt : doname(obj)), cost, currency(cost));
#ifndef GOLDOBJ
} else if (obj && obj->oclass == GOLD_CLASS) {
Sprintf(li, "%ld gold piece%s%s", obj->quan, plur(obj->quan),
@@ -2193,7 +2201,7 @@ doprgold()
if(!umoney)
Your("wallet is empty.");
else
Your("wallet contains %ld zorkmid%s.", umoney, plur(umoney));
Your("wallet contains %ld %s.", umoney, currency(umoney));
#endif
shopper_financial_report();
return 0;