From 4e5b8a1a194653b228d129681f65210b04a79b3a Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sun, 8 Nov 2015 11:46:11 +0100 Subject: [PATCH 1/2] Add South Korean Won and Russian Rouble as currencies, closes #2222, also fix #2232 --- data/language/english_uk.txt | 2 ++ src/config.c | 2 ++ src/localisation/currency.c | 22 ++++++++++++---------- src/localisation/currency.h | 3 +++ src/windows/options.c | 9 +++++---- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/data/language/english_uk.txt b/data/language/english_uk.txt index 7dca2507a9..7bb2fe1e1b 100644 --- a/data/language/english_uk.txt +++ b/data/language/english_uk.txt @@ -3915,6 +3915,8 @@ STR_5573 :Remove From Favorites STR_5574 :Server Name: STR_5575 :Max Players: STR_5576 :Port: +STR_5577 :South Korean Won (W) +STR_5578 :Russian Rouble (R) ##################### # Rides/attractions # diff --git a/src/config.c b/src/config.c index 40e83036fa..493e501952 100644 --- a/src/config.c +++ b/src/config.c @@ -124,6 +124,8 @@ config_enum_definition _currencyEnum[] = { { "NLG", CURRENCY_GUILDERS }, { "SEK", CURRENCY_KRONA }, { "EUR", CURRENCY_EUROS }, + { "KRW", CURRENCY_WON }, + { "RUB", CURRENCY_ROUBLE }, END_OF_ENUM }; diff --git a/src/localisation/currency.c b/src/localisation/currency.c index d451a8bc27..b106cba164 100644 --- a/src/localisation/currency.c +++ b/src/localisation/currency.c @@ -21,14 +21,16 @@ #include "currency.h" const rct_currency_spec g_currency_specs[CURRENCY_END] = { - { 10 , "\xC2\xA3" , CURRENCY_PREFIX }, // British Pound - { 10 , "$" , CURRENCY_PREFIX }, // US Dollar - { 10 , "F" , CURRENCY_SUFFIX }, // French Franc - { 10 , "DM" , CURRENCY_PREFIX }, // Deutsche Mark - { 1000 , "\xC2\xA5" , CURRENCY_PREFIX }, // Japanese Yen - { 10 , "Pts" , CURRENCY_SUFFIX }, // Spanish Peseta - { 1000 , "L" , CURRENCY_PREFIX }, // Italian Lira - { 10 , "fl. " , CURRENCY_PREFIX }, // Dutch Guilder - { 10 , "kr." , CURRENCY_SUFFIX }, // Swedish Krona - { 10 , "\xE2\x82\xAC" , CURRENCY_PREFIX }, // Euro + { 10 , "\xC2\xA3" , CURRENCY_PREFIX, 2334 }, // British Pound + { 10 , "$" , CURRENCY_PREFIX, 2335}, // US Dollar + { 10 , "F" , CURRENCY_SUFFIX, 2336 }, // French Franc + { 10 , "DM" , CURRENCY_PREFIX, 2337 }, // Deutsche Mark + { 1000 , "\xC2\xA5" , CURRENCY_PREFIX, 2338 }, // Japanese Yen + { 10 , "Pts" , CURRENCY_SUFFIX, 2339 }, // Spanish Peseta + { 1000 , "L" , CURRENCY_PREFIX, 2340 }, // Italian Lira + { 10 , "fl. " , CURRENCY_PREFIX, 2341 }, // Dutch Guilder + { 10 , "kr." , CURRENCY_SUFFIX, 2342 }, // Swedish Krona + { 10 , "\xE2\x82\xAC" , CURRENCY_PREFIX, 2343 }, // Euro + { 10000 , "W" , CURRENCY_PREFIX, 5577 }, // South Korean Won + { 1000 , "R " , CURRENCY_PREFIX, 5578 }, // Russian Rouble }; diff --git a/src/localisation/currency.h b/src/localisation/currency.h index 9ed73bf71c..4cba80c1c6 100644 --- a/src/localisation/currency.h +++ b/src/localisation/currency.h @@ -35,6 +35,8 @@ typedef enum { CURRENCY_GUILDERS, // Dutch Gilder CURRENCY_KRONA, // Swedish Krona CURRENCY_EUROS, // Euro + CURRENCY_WON, // South Korean Won + CURRENCY_ROUBLE, // Russian Rouble CURRENCY_END // Last item } CURRENCY_TYPE; @@ -52,6 +54,7 @@ typedef struct { int rate; utf8 symbol[CURRENCY_SYMBOL_MAX_SIZE]; int affix; + int stringId; } rct_currency_spec; // List of currency formats diff --git a/src/windows/options.c b/src/windows/options.c index 98c76ca241..4609c5bfe1 100644 --- a/src/windows/options.c +++ b/src/windows/options.c @@ -36,6 +36,7 @@ #include "../interface/viewport.h" #include "../interface/widget.h" #include "../interface/window.h" +#include "../localisation/currency.h" #include "../localisation/date.h" #include "../localisation/localisation.h" #include "../platform/platform.h" @@ -773,14 +774,14 @@ static void window_options_mousedown(int widgetIndex, rct_window*w, rct_widget* window_options_show_dropdown(w, widget, 2); - dropdown_set_checked(gConfigGeneral.show_height_as_units ? 1 : 2, true); + dropdown_set_checked(gConfigGeneral.show_height_as_units ? 0 : 1, true); break; case WIDX_CURRENCY_DROPDOWN: - num_items = 10; + num_items = CURRENCY_END; for (i = 0; i < num_items; i++) { gDropdownItemsFormat[i] = 1142; - gDropdownItemsArgs[i] = STR_POUNDS + i; + gDropdownItemsArgs[i] = g_currency_specs[i].stringId; } window_options_show_dropdown(w, widget, num_items); @@ -1181,7 +1182,7 @@ static void window_options_invalidate(rct_window *w) case WINDOW_OPTIONS_PAGE_CULTURE: // currency: pounds, dollars, etc. (10 total) - RCT2_GLOBAL(0x013CE952 + 12, uint16) = STR_POUNDS + gConfigGeneral.currency_format; + RCT2_GLOBAL(0x013CE952 + 12, uint16) = g_currency_specs[gConfigGeneral.currency_format].stringId; // distance: metric/imperial RCT2_GLOBAL(0x013CE952 + 14, uint16) = STR_IMPERIAL + gConfigGeneral.measurement_format; From eed070bde016be3ce7f9a410cf134fcf0380f656 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sun, 8 Nov 2015 12:41:55 +0100 Subject: [PATCH 2/2] Use string IDs for all currencies --- src/localisation/currency.c | 25 +++++++++++++------------ src/localisation/string_ids.h | 3 +++ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/localisation/currency.c b/src/localisation/currency.c index b106cba164..1411e21491 100644 --- a/src/localisation/currency.c +++ b/src/localisation/currency.c @@ -19,18 +19,19 @@ *****************************************************************************/ #include "currency.h" +#include "string_ids.h" const rct_currency_spec g_currency_specs[CURRENCY_END] = { - { 10 , "\xC2\xA3" , CURRENCY_PREFIX, 2334 }, // British Pound - { 10 , "$" , CURRENCY_PREFIX, 2335}, // US Dollar - { 10 , "F" , CURRENCY_SUFFIX, 2336 }, // French Franc - { 10 , "DM" , CURRENCY_PREFIX, 2337 }, // Deutsche Mark - { 1000 , "\xC2\xA5" , CURRENCY_PREFIX, 2338 }, // Japanese Yen - { 10 , "Pts" , CURRENCY_SUFFIX, 2339 }, // Spanish Peseta - { 1000 , "L" , CURRENCY_PREFIX, 2340 }, // Italian Lira - { 10 , "fl. " , CURRENCY_PREFIX, 2341 }, // Dutch Guilder - { 10 , "kr." , CURRENCY_SUFFIX, 2342 }, // Swedish Krona - { 10 , "\xE2\x82\xAC" , CURRENCY_PREFIX, 2343 }, // Euro - { 10000 , "W" , CURRENCY_PREFIX, 5577 }, // South Korean Won - { 1000 , "R " , CURRENCY_PREFIX, 5578 }, // Russian Rouble + { 10 , "\xC2\xA3" , CURRENCY_PREFIX, STR_POUNDS }, // British Pound + { 10 , "$" , CURRENCY_PREFIX, STR_DOLLARS}, // US Dollar + { 10 , "F" , CURRENCY_SUFFIX, STR_FRANC }, // French Franc + { 10 , "DM" , CURRENCY_PREFIX, STR_DEUTSCHMARK }, // Deutschmark + { 1000 , "\xC2\xA5" , CURRENCY_PREFIX, STR_YEN }, // Japanese Yen + { 10 , "Pts" , CURRENCY_SUFFIX, STR_PESETA }, // Spanish Peseta + { 1000 , "L" , CURRENCY_PREFIX, STR_LIRA }, // Italian Lira + { 10 , "fl. " , CURRENCY_PREFIX, STR_GUILDERS }, // Dutch Guilder + { 10 , "kr." , CURRENCY_SUFFIX, STR_KRONA }, // Swedish Krona + { 10 , "\xE2\x82\xAC" , CURRENCY_PREFIX, STR_EUROS }, // Euro + { 10000 , "W" , CURRENCY_PREFIX, STR_WON }, // South Korean Won + { 1000 , "R " , CURRENCY_PREFIX, STR_ROUBLE }, // Russian Rouble }; diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h index c6192a913a..1091f29339 100644 --- a/src/localisation/string_ids.h +++ b/src/localisation/string_ids.h @@ -2166,6 +2166,9 @@ enum { STR_MAX_PLAYERS = 5575, STR_PORT = 5576, + STR_WON = 5577, + STR_ROUBLE = 5578, + // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working STR_COUNT = 32768 };