Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Currency setting desync between ISO code and locale_currencies setting label #9484

Closed
James103 opened this issue Aug 15, 2021 · 0 comments
Milestone

Comments

@James103
Copy link
Contributor

Version of OpenTTD

12.0-beta 1 via Steam (Win 10)

Expected result

The locale_currencies table should be 41 entries long instead of 28, and each entry should have the proper ISO code for that currency or custom for the custom currency at index 31 (not 28).

Expected console output for set currency 28 then set currency:
Current value for 'locale.currency' is 'LTL' (min: 0, max: 41)

Expected console output for set currency 3 then set currency:
Current value for 'locale.currency' is 'JPY' (min: 0, max: 41)

Expected console output for set currency 31 then set currency:
Current value for 'locale.currency' is 'custom' (min: 0, max: 41)

Expected console output for set currency 41 then set currency:
Current value for 'locale.currency' is 'MYR' (min: 0, max: 41)

Actual result

The following currencies have different values for the _locale_currencies table compared to their ISO code:

Index _locale_currencies at index ISO code at index
3 YEN JPY
24 YTL TRY
28 custom LTL
29 N/A KRW
30 N/A ZAR
31 N/A Custom
32 N/A GEL
33 N/A IRR
34 N/A RUB
35 N/A MXN
36 N/A NTD
37 N/A CNY
38 N/A HKD
39 N/A INR
40 N/A IDR
41 N/A MYR

The _locale_currency table is stored here:

static std::initializer_list<const char*> _locale_currencies{"GBP", "USD", "EUR", "YEN", "ATS", "BEF", "CHF", "CZK", "DEM", "DKK", "ESP", "FIM", "FRF", "GRD", "HUF", "ISK", "ITL", "NLG", "NOK", "PLN", "RON", "RUR", "SIT", "SEK", "YTL", "SKK", "BRL", "EEK", "custom"};

The ISO codes are found in the last 3 letters of the string's ID name in the following list:

############ start of currency region
STR_GAME_OPTIONS_CURRENCY_GBP :British Pound (GBP)
STR_GAME_OPTIONS_CURRENCY_USD :American Dollar (USD)
STR_GAME_OPTIONS_CURRENCY_EUR :Euro (EUR)
STR_GAME_OPTIONS_CURRENCY_JPY :Japanese Yen (JPY)
STR_GAME_OPTIONS_CURRENCY_ATS :Austrian Shilling (ATS)
STR_GAME_OPTIONS_CURRENCY_BEF :Belgian Franc (BEF)
STR_GAME_OPTIONS_CURRENCY_CHF :Swiss Franc (CHF)
STR_GAME_OPTIONS_CURRENCY_CZK :Czech Koruna (CZK)
STR_GAME_OPTIONS_CURRENCY_DEM :Deutschmark (DEM)
STR_GAME_OPTIONS_CURRENCY_DKK :Danish Krone (DKK)
STR_GAME_OPTIONS_CURRENCY_ESP :Spanish Peseta (ESP)
STR_GAME_OPTIONS_CURRENCY_FIM :Finnish Markka (FIM)
STR_GAME_OPTIONS_CURRENCY_FRF :French Franc (FRF)
STR_GAME_OPTIONS_CURRENCY_GRD :Greek Drachma (GRD)
STR_GAME_OPTIONS_CURRENCY_HUF :Hungarian Forint (HUF)
STR_GAME_OPTIONS_CURRENCY_ISK :Icelandic Krona (ISK)
STR_GAME_OPTIONS_CURRENCY_ITL :Italian Lira (ITL)
STR_GAME_OPTIONS_CURRENCY_NLG :Dutch Guilder (NLG)
STR_GAME_OPTIONS_CURRENCY_NOK :Norwegian Krone (NOK)
STR_GAME_OPTIONS_CURRENCY_PLN :Polish Złoty (PLN)
STR_GAME_OPTIONS_CURRENCY_RON :Romanian Leu (RON)
STR_GAME_OPTIONS_CURRENCY_RUR :Russian Rubles (RUR)
STR_GAME_OPTIONS_CURRENCY_SIT :Slovenian Tolar (SIT)
STR_GAME_OPTIONS_CURRENCY_SEK :Swedish Krona (SEK)
STR_GAME_OPTIONS_CURRENCY_TRY :Turkish Lira (TRY)
STR_GAME_OPTIONS_CURRENCY_SKK :Slovak Koruna (SKK)
STR_GAME_OPTIONS_CURRENCY_BRL :Brazilian Real (BRL)
STR_GAME_OPTIONS_CURRENCY_EEK :Estonian Krooni (EEK)
STR_GAME_OPTIONS_CURRENCY_LTL :Lithuanian Litas (LTL)
STR_GAME_OPTIONS_CURRENCY_KRW :South Korean Won (KRW)
STR_GAME_OPTIONS_CURRENCY_ZAR :South African Rand (ZAR)
STR_GAME_OPTIONS_CURRENCY_CUSTOM :Custom...
STR_GAME_OPTIONS_CURRENCY_GEL :Georgian Lari (GEL)
STR_GAME_OPTIONS_CURRENCY_IRR :Iranian Rial (IRR)
STR_GAME_OPTIONS_CURRENCY_RUB :New Russian Ruble (RUB)
STR_GAME_OPTIONS_CURRENCY_MXN :Mexican Peso (MXN)
STR_GAME_OPTIONS_CURRENCY_NTD :New Taiwan Dollar (NTD)
STR_GAME_OPTIONS_CURRENCY_CNY :Chinese Renminbi (CNY)
STR_GAME_OPTIONS_CURRENCY_HKD :Hong Kong Dollar (HKD)
STR_GAME_OPTIONS_CURRENCY_INR :Indian Rupee (INR)
STR_GAME_OPTIONS_CURRENCY_IDR :Indonesian Rupiah (IDR)
STR_GAME_OPTIONS_CURRENCY_MYR :Malaysian Ringgit (MYR)
############ end of currency region

Actual console output for set currency 28 then set currency:
Current value for 'locale.currency' is 'custom' (min: 0, max: 41)

Actual console output for set currency 3 then set currency:
Current value for 'locale.currency' is 'YEN' (min: 0, max: 41)

Actual console output for set currency 31 then set currency:
Current value for 'locale.currency' is '31' (min: 0, max: 41)

Actual console output for set currency 41 then set currency:
Current value for 'locale.currency' is '41' (min: 0, max: 41)

Steps to reproduce

  1. Open the Settings window.
  2. Repeat the below steps for each of the above currencies.
  3. Set "Currency units" to the value with the corresponding ISO code, or run set currency [index] with the corresponding index.
  4. Run set currency in console and notice the output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants