mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r9467) -Fix(FS#703,6108): When resetting the array of currencies, the custom currency was reset too, thus loosing the setting a user could have used for it.(glx)
This commit is contained in:
parent
45e788d524
commit
683aae8abf
|
@ -158,12 +158,17 @@ void CheckSwitchToEuro()
|
|||
}
|
||||
|
||||
/**
|
||||
* Called only from newgrf.c. Will fill _currency_specs array with
|
||||
* Will fill _currency_specs array with
|
||||
* default values from origin_currency_specs
|
||||
* Called only from newgrf.cpp and settings.cpp.
|
||||
* @param preserve_custom will not reset custom currency (the latest one on the list)
|
||||
* if ever it is flagged to true. In which case, the total size of the memory to move
|
||||
* will be one currency spec less, thus preserving the custom curreny from been
|
||||
* overwritten.
|
||||
**/
|
||||
void ResetCurrencies()
|
||||
void ResetCurrencies(bool preserve_custom)
|
||||
{
|
||||
memcpy(&_currency_specs, &origin_currency_specs, sizeof(origin_currency_specs));
|
||||
memcpy(&_currency_specs, &origin_currency_specs, sizeof(origin_currency_specs) - (preserve_custom ? sizeof(_custom_currency) : 0));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,7 +40,7 @@ extern CurrencySpec _currency_specs[NUM_CURRENCY];
|
|||
|
||||
uint GetMaskOfAllowedCurrencies();
|
||||
void CheckSwitchToEuro();
|
||||
void ResetCurrencies();
|
||||
void ResetCurrencies(bool preserve_custom = true);
|
||||
StringID* BuildCurrencyDropdown();
|
||||
byte GetNewgrfCurrencyIdConverted(byte grfcurr_id);
|
||||
|
||||
|
|
|
@ -1685,6 +1685,7 @@ extern void CheckDifficultyLevels();
|
|||
void LoadFromConfig()
|
||||
{
|
||||
IniFile *ini = ini_load(_config_file);
|
||||
ResetCurrencies(false); // Initialize the array of curencies, without preserving the custom one
|
||||
HandleSettingDescs(ini, ini_load_settings, ini_load_setting_list);
|
||||
_grfconfig_newgame = GRFLoadConfig(ini, "newgrf", false);
|
||||
_grfconfig_static = GRFLoadConfig(ini, "newgrf-static", true);
|
||||
|
|
Loading…
Reference in New Issue