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:
10
src/end.c
10
src/end.c
@@ -463,10 +463,10 @@ winid endwin;
|
||||
otmp->known = otmp->bknown = otmp->dknown =
|
||||
otmp->rknown = 1;
|
||||
/* assumes artifacts don't have quan>1 */
|
||||
Sprintf(pbuf, "%s (worth %ld zorkmids and %ld points)",
|
||||
Sprintf(pbuf, "%s (worth %ld %s and %ld points)",
|
||||
otmp->oartifact ? artifact_name(xname(otmp), &dummy) :
|
||||
OBJ_NAME(objects[otmp->otyp]),
|
||||
100L * (long)objects[otmp->otyp].oc_cost,
|
||||
100L * (long)objects[otmp->otyp].oc_cost, currency(2L),
|
||||
250L * (long)objects[otmp->otyp].oc_cost);
|
||||
putstr(endwin, 0, pbuf);
|
||||
}
|
||||
@@ -561,7 +561,7 @@ die:
|
||||
* smiling... :-) -3.
|
||||
*/
|
||||
if (moves <= 1 && how < PANICKED) /* You die... --More-- */
|
||||
pline("Do not pass go. Do not collect 200 zorkmids.");
|
||||
pline("Do not pass go. Do not collect 200 %s.", currency(200L));
|
||||
|
||||
if (have_windows) wait_synch(); /* flush screen output */
|
||||
#ifndef NO_SIGNAL
|
||||
@@ -769,9 +769,9 @@ die:
|
||||
otmp->dknown = 1; /* seen it (blindness fix) */
|
||||
otmp->onamelth = 0;
|
||||
otmp->quan = count;
|
||||
Sprintf(pbuf, "%8ld %s (worth %ld zorkmids),",
|
||||
Sprintf(pbuf, "%8ld %s (worth %ld %s),",
|
||||
count, xname(otmp),
|
||||
count * (long)objects[typ].oc_cost);
|
||||
count * (long)objects[typ].oc_cost, currency(2L));
|
||||
obfree(otmp, (struct obj *)0);
|
||||
} else {
|
||||
Sprintf(pbuf,
|
||||
|
||||
Reference in New Issue
Block a user