1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-09-03 03:49:12 +00:00

(svn r10820) -Codechange: make negative currencies red and restore the colour from before the currency was printed; this removes the need to make two strings for printing currencies (one for positive currencies and one for negative currencies).

-Fix [FS#1036]: do not use green for currencies as it is practically unreadable on CRT monitors.
This commit is contained in:
rubidium
2007-08-07 15:20:31 +00:00
parent a7e37d8592
commit c46e445e69
5 changed files with 18 additions and 21 deletions

View File

@@ -343,6 +343,8 @@ static char *FormatGenericCurrency(char *buff, const CurrencySpec *spec, Money n
/* convert from negative */
if (number < 0) {
if (buff + Utf8CharLen(SCC_RED) > last) return buff;
buff += Utf8Encode(buff, SCC_RED);
buff = strecpy(buff, "-", last);
number = -number;
}
@@ -383,6 +385,12 @@ static char *FormatGenericCurrency(char *buff, const CurrencySpec *spec, Money n
* The only remaining value is 1 (prefix), so everything that is not 0 */
if (spec->symbol_pos != 0) buff = strecpy(buff, spec->suffix, last);
if (cs.GetCost() < 0) {
if (buff + Utf8CharLen(SCC_PREVIOUS_COLOUR) > last) return buff;
buff += Utf8Encode(buff, SCC_PREVIOUS_COLOUR);
*buff = '\0';
}
return buff;
}