From 792e70d00c178c1fdd5eae15688886aa397b5f56 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Wed, 10 Jun 2015 17:53:57 +0100 Subject: [PATCH] Round the currency away from zero. Change the profit per hour to use 2dp currency. Fixes #1227 --- data/language/english_uk.txt | 8 ++++---- src/localisation/localisation.c | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/data/language/english_uk.txt b/data/language/english_uk.txt index 8a6b27b5ba..e1ff4da7f7 100644 --- a/data/language/english_uk.txt +++ b/data/language/english_uk.txt @@ -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 diff --git a/src/localisation/localisation.c b/src/localisation/localisation.c index 1facbdcee3..01cb13e66c 100644 --- a/src/localisation/localisation.c +++ b/src/localisation/localisation.c @@ -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;