1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 08:12:53 +01:00

Fix negative zero in currency display.

This commit is contained in:
Duncan Frost
2015-06-09 20:58:55 +01:00
parent 966e82a31a
commit f6507f70bc

View File

@@ -299,6 +299,10 @@ void format_currency(char **dest, long long value)
int rate = currencySpec->rate;
value *= rate;
// Divide by 100 to get rid of the pennies
// Do this before anything else to prevent negative zero.
value /= 100;
// Negative sign
if (value < 0) {
*(*dest)++ = '-';
@@ -314,8 +318,7 @@ void format_currency(char **dest, long long value)
*dest += strlen(*dest);
}
// Divide by 100 to get rid of the pennies
format_comma_separated_integer(dest, value / 100);
format_comma_separated_integer(dest, value);
// Currency symbol suffix
if (currencySpec->affix == CURRENCY_SUFFIX) {