summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2014-01-15 21:52:22 +0000
committerfrosch <frosch@openttd.org>2014-01-15 21:52:22 +0000
commite3947c8019fb2259b620ed79872bdafe60cc0ed2 (patch)
treeb648e51cc82552032b61030e12f8079a1e61bed2
parent1213e6ba71b6a3d253d73a9761b75a1bf5e98c33 (diff)
downloadopenttd-e3947c8019fb2259b620ed79872bdafe60cc0ed2.tar.xz
(svn r26262) -Fix (r25075, r25076): Custom currency was reset on game start.
-rw-r--r--src/currency.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/currency.cpp b/src/currency.cpp
index 4da6a87f7..52060e21c 100644
--- a/src/currency.cpp
+++ b/src/currency.cpp
@@ -144,14 +144,14 @@ void CheckSwitchToEuro()
* 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 currency from been
- * overwritten.
+ * @param preserve_custom will not reset custom currency
*/
void ResetCurrencies(bool preserve_custom)
{
- memcpy(&_currency_specs, &origin_currency_specs, sizeof(origin_currency_specs) - (preserve_custom ? sizeof(_custom_currency) : 0));
+ for (uint i = 0; i < CURRENCY_END; i++) {
+ if (preserve_custom && i == CURRENCY_CUSTOM) continue;
+ _currency_specs[i] = origin_currency_specs[i];
+ }
}
/**