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

Round the currency away from zero.

Change the profit per hour to use 2dp currency. Fixes #1227
This commit is contained in:
Duncan Frost
2015-06-10 17:53:57 +01:00
parent f6507f70bc
commit 792e70d00c
2 changed files with 10 additions and 8 deletions

View File

@@ -1842,7 +1842,7 @@ STR_1837 :Satisfaction: Unknown
STR_1838 :Satisfaction: {COMMA16}%
STR_1839 :Reliability: {COMMA16}%
STR_1840 :Down-time: {COMMA16}%
STR_1841 :Profit: {CURRENCY} per hour
STR_1841 :Profit: {CURRENCY2DP} per hour
STR_1842 :Favourite of: {COMMA16} guest
STR_1843 :Favourite of: {COMMA16} guests
STR_1844 :{SMALLFONT}{BLACK}Select information type to show in ride/attraction list
@@ -1859,7 +1859,7 @@ STR_1854 :{WINDOW_COLOUR_2}Built: {BLACK}Last Year
STR_1855 :{WINDOW_COLOUR_2}Built: {BLACK}{COMMA16} Years Ago
STR_1856 :{WINDOW_COLOUR_2}Profit per item sold: {BLACK}{CURRENCY2DP}
STR_1857 :{WINDOW_COLOUR_2}Loss per item sold: {BLACK}{CURRENCY2DP}
STR_1858 :{WINDOW_COLOUR_2}Cost: {BLACK}{CURRENCY} per month
STR_1858 :{WINDOW_COLOUR_2}Cost: {BLACK}{CURRENCY2DP} per month
STR_1859 :Handymen
STR_1860 :Mechanics
STR_1861 :Security Guards
@@ -1874,8 +1874,8 @@ STR_1869 :{WINDOW_COLOUR_2}Number of rotations:
STR_1870 :{SMALLFONT}{BLACK}Number of complete rotations
STR_1871 :{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{COMMA16}
STR_1872 :{COMMA16}
STR_1873 :{WINDOW_COLOUR_2}Income: {BLACK}{CURRENCY} per hour
STR_1874 :{WINDOW_COLOUR_2}Profit: {BLACK}{CURRENCY} per hour
STR_1873 :{WINDOW_COLOUR_2}Income: {BLACK}{CURRENCY2DP} per hour
STR_1874 :{WINDOW_COLOUR_2}Profit: {BLACK}{CURRENCY2DP} per hour
STR_1875 :{BLACK} {SPRITE}{BLACK} {STRINGID}
STR_1876 :{WINDOW_COLOUR_2}{INLINE_SPRITE}{251}{19}{00}{00}Inspect Rides
STR_1877 :{WINDOW_COLOUR_2}{INLINE_SPRITE}{252}{19}{00}{00}Fix Rides

View File

@@ -299,15 +299,17 @@ 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) {
// Round the value away from zero
value = (value - 99) / 100;
*(*dest)++ = '-';
value = -value;
}
else{
//Round the value away from zero
value = (value + 99) / 100;
}
// Currency symbol
const char *symbol = currencySpec->symbol;