From 50c2e52b57bc6cd3bebc2df19eb9e426cb2a18a2 Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Sun, 10 Jul 2016 09:26:23 +0100 Subject: [PATCH] Use better text descriptions. Holding down rate buttons now increase/decrease --- data/language/en-GB.txt | 2 ++ src/localisation/currency.h | 1 + src/localisation/string_ids.h | 2 ++ src/windows/custom_currency.c | 12 +++++++----- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index cee3042192..47a0ee4cbe 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -4201,6 +4201,8 @@ STR_5889 :Custom currency symbol STR_5890 :Enter the currency symbol to display STR_5891 :Default STR_5892 :{SMALLFONT}{BLACK}Go to the default directory +STR_5893 :Exchange Rate +STR_5894 :Enter the exchange rate ############# # Scenarios # diff --git a/src/localisation/currency.h b/src/localisation/currency.h index 6f6318ded6..1c24826983 100644 --- a/src/localisation/currency.h +++ b/src/localisation/currency.h @@ -49,6 +49,7 @@ typedef enum { } CURRENCY_AFFIX; #define CURRENCY_SYMBOL_MAX_SIZE 8 +#define CURRENCY_RATE_MAX_NUM_DIGITS 9 // Currency format specification - inspired by OpenTTD typedef struct currency_descriptor { diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h index 3e2ba714f0..52a2471078 100644 --- a/src/localisation/string_ids.h +++ b/src/localisation/string_ids.h @@ -2672,6 +2672,8 @@ enum { STR_LOADSAVE_DEFAULT = 5891, STR_LOADSAVE_DEFAULT_TIP = 5892, + STR_RATE_INPUT_TITLE = 5893, + STR_RATE_INPUT_DESC = 5894, // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working STR_COUNT = 32768 }; diff --git a/src/windows/custom_currency.c b/src/windows/custom_currency.c index 555e8ddcb1..19f9b37e44 100644 --- a/src/windows/custom_currency.c +++ b/src/windows/custom_currency.c @@ -115,6 +115,7 @@ void custom_currency_window_open() (1 << WIDX_AFFIX_DROPDOWN) | (1 << WIDX_AFFIX_DROPDOWN_BUTTON); + window->hold_down_widgets = (1 << WIDX_RATE_UP) | (1 << WIDX_RATE_DOWN); window_init_scroll_widgets(window); window->colours[0] = 22; window->colours[1] = 22; @@ -192,13 +193,14 @@ static void custom_currency_window_mouseup(rct_window *w, int widgetIndex) { switch(widgetIndex) { case WIDX_RATE: - window_text_input_raw_open( + window_text_input_open( w, WIDX_RATE, - STR_CUSTOM_CURRENCY_SYMBOL_INPUT_TITLE, - STR_CUSTOM_CURRENCY_SYMBOL_INPUT_DESC, - CurrencyDescriptors[CURRENCY_CUSTOM].symbol_unicode, - CURRENCY_SYMBOL_MAX_SIZE + STR_RATE_INPUT_TITLE, + STR_RATE_INPUT_DESC, + 5182, + (uint32)CurrencyDescriptors[CURRENCY_CUSTOM].rate, + CURRENCY_RATE_MAX_NUM_DIGITS ); break; }