src/currency.cpp
branchnoai
changeset 9545 179f651eb116
parent 6573 7624f942237f
child 6872 1c4a4a609f85
child 8636 2b158acb649c
equal deleted inserted replaced
9544:54705d209c44 9545:179f651eb116
   156 		AddNewsItem(STR_EURO_INTRODUCE, NEWS_FLAGS(NM_NORMAL, 0, NT_ECONOMY, 0), 0, 0);
   156 		AddNewsItem(STR_EURO_INTRODUCE, NEWS_FLAGS(NM_NORMAL, 0, NT_ECONOMY, 0), 0, 0);
   157 	}
   157 	}
   158 }
   158 }
   159 
   159 
   160 /**
   160 /**
   161  * Called only from newgrf.c.  Will fill _currency_specs array with
   161  * Will fill _currency_specs array with
   162  * default values from origin_currency_specs
   162  * default values from origin_currency_specs
       
   163  * Called only from newgrf.cpp and settings.cpp.
       
   164  * @param preserve_custom will not reset custom currency (the latest one on the list)
       
   165  *        if ever it is flagged to true. In which case, the total size of the memory to move
       
   166  *        will be one currency spec less, thus preserving the custom curreny from been
       
   167  *        overwritten.
   163  **/
   168  **/
   164 void ResetCurrencies()
   169 void ResetCurrencies(bool preserve_custom)
   165 {
   170 {
   166 	memcpy(&_currency_specs, &origin_currency_specs, sizeof(origin_currency_specs));
   171 	memcpy(&_currency_specs, &origin_currency_specs, sizeof(origin_currency_specs) - (preserve_custom ? sizeof(_custom_currency) : 0));
   167 }
   172 }
   168 
   173 
   169 /**
   174 /**
   170  * Build a list of currency names StringIDs to use in a dropdown list
   175  * Build a list of currency names StringIDs to use in a dropdown list
   171  * @return Pointer to a (static) array of StringIDs
   176  * @return Pointer to a (static) array of StringIDs