src/currency.cpp
branchnoai
changeset 9545 179f651eb116
parent 6573 7624f942237f
child 6872 1c4a4a609f85
child 8636 2b158acb649c
--- a/src/currency.cpp	Sun Mar 25 23:39:05 2007 +0000
+++ b/src/currency.cpp	Sun Mar 25 23:51:30 2007 +0000
@@ -158,12 +158,17 @@
 }
 
 /**
- * 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));
 }
 
 /**