diff options
author | planetmaker <planetmaker@openttd.org> | 2013-03-09 16:24:43 +0000 |
---|---|---|
committer | planetmaker <planetmaker@openttd.org> | 2013-03-09 16:24:43 +0000 |
commit | fae3cbae9fffc2fa3315d4e77f31bdd7d5a34a2c (patch) | |
tree | 3e552dbe9119aea670c6b85757d03c1adcb15588 | |
parent | bd301e84757755f08657aaf98059c206f2480a3a (diff) | |
download | openttd-fae3cbae9fffc2fa3315d4e77f31bdd7d5a34a2c.tar.xz |
(svn r25075) -Codechange: Allow for more than 32 currencies
-rw-r--r-- | src/currency.cpp | 10 | ||||
-rw-r--r-- | src/currency.h | 2 | ||||
-rw-r--r-- | src/settings_gui.cpp | 2 |
3 files changed, 8 insertions, 6 deletions
diff --git a/src/currency.cpp b/src/currency.cpp index bae5f08d1..e812538e3 100644 --- a/src/currency.cpp +++ b/src/currency.cpp @@ -10,6 +10,8 @@ /** @file currency.cpp Support for different currencies. */ #include "stdafx.h" +#include "core/bitmath_func.hpp" + #include "currency.h" #include "news_func.h" #include "settings_type.h" @@ -107,9 +109,9 @@ byte GetNewgrfCurrencyIdConverted(byte grfcurr_id) * get a mask of the allowed currencies depending on the year * @return mask of currencies */ -uint GetMaskOfAllowedCurrencies() +uint64 GetMaskOfAllowedCurrencies() { - uint mask = 0; + uint64 mask = 0LL; uint i; for (i = 0; i < CURRENCY_END; i++) { @@ -117,9 +119,9 @@ uint GetMaskOfAllowedCurrencies() if (to_euro != CF_NOEURO && to_euro != CF_ISEURO && _cur_year >= to_euro) continue; if (to_euro == CF_ISEURO && _cur_year < 2000) continue; - mask |= (1 << i); + SetBit(mask, i); } - mask |= (1 << CURRENCY_CUSTOM); // always allow custom currency + SetBit(mask, CURRENCY_CUSTOM); // always allow custom currency return mask; } diff --git a/src/currency.h b/src/currency.h index c4476b767..aa29efdf7 100644 --- a/src/currency.h +++ b/src/currency.h @@ -85,7 +85,7 @@ extern CurrencySpec _currency_specs[CURRENCY_END]; #define _custom_currency (_currency_specs[CURRENCY_CUSTOM]) #define _currency ((const CurrencySpec*)&_currency_specs[GetGameSettings().locale.currency]) -uint GetMaskOfAllowedCurrencies(); +uint64 GetMaskOfAllowedCurrencies(); void CheckSwitchToEuro(); void ResetCurrencies(bool preserve_custom = true); StringID *BuildCurrencyDropdown(); diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 50b0b880c..3a20f455f 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -189,7 +189,7 @@ struct GameOptionsWindow : Window { list = new DropDownList(); *selected_index = this->opt->locale.currency; StringID *items = BuildCurrencyDropdown(); - uint disabled = _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies(); + uint64 disabled = _game_mode == GM_MENU ? 0LL : ~GetMaskOfAllowedCurrencies(); /* Add non-custom currencies; sorted naturally */ for (uint i = 0; i < CURRENCY_END; items++, i++) { |