diff options
author | belugas <belugas@openttd.org> | 2007-03-25 23:42:55 +0000 |
---|---|---|
committer | belugas <belugas@openttd.org> | 2007-03-25 23:42:55 +0000 |
commit | 32b33e31218eb19b6775f51e731755d9b0c05a49 (patch) | |
tree | 17be004bb6cdaa3f396df286149703a5d9bde6d2 /src/currency.cpp | |
parent | f9547cf3b20fdab423e999de6b6adf3d9a7d05a7 (diff) | |
download | openttd-32b33e31218eb19b6775f51e731755d9b0c05a49.tar.xz |
(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)
Diffstat (limited to 'src/currency.cpp')
-rw-r--r-- | src/currency.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/currency.cpp b/src/currency.cpp index 4abf7cbd9..8d7ecbef7 100644 --- a/src/currency.cpp +++ b/src/currency.cpp @@ -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)); } /** |