Move loading custom currency-related preferences code into currency.c

This commit is contained in:
Daniel Trujillo 2016-07-01 23:52:33 +02:00
parent 4ebcf80a1a
commit a29db378eb
3 changed files with 17 additions and 5 deletions

View File

@ -14,6 +14,7 @@
*****************************************************************************/
#pragma endregion
#include "../config.h"
#include "currency.h"
#include "string_ids.h"
@ -36,3 +37,10 @@ currency_descriptor CurrencyDescriptors[CURRENCY_END] = {
{ "CNY", 100, CURRENCY_PREFIX, "CN\xC2\xA5", CURRENCY_PREFIX, "CNY", STR_CHINESE_YUAN }, // Chinese Yuan
{ "CTM", 10, CURRENCY_PREFIX, "Ctm", CURRENCY_PREFIX, "Ctm", STR_CUSTOM_CURRENCY }, // Customizable currency
};
void currency_load_custom_currency_config()
{
CurrencyDescriptors[CURRENCY_CUSTOM].rate = gConfigGeneral.custom_currency_rate;
CurrencyDescriptors[CURRENCY_CUSTOM].affix_unicode = gConfigGeneral.custom_currency_affix;
strncpy(CurrencyDescriptors[CURRENCY_CUSTOM].symbol_unicode, gConfigGeneral.custom_currency_symbol, CURRENCY_SYMBOL_MAX_SIZE);
}

View File

@ -65,4 +65,10 @@ typedef struct currency_descriptor {
// List of currency formats
extern currency_descriptor CurrencyDescriptors[CURRENCY_END];
/**
* Loads custom currency saved parameters into {@link CurrencyDescriptors}'
* custom currency entry
*/
void currency_load_custom_currency_config();
#endif

View File

@ -26,6 +26,7 @@
#include "interface/window.h"
#include "interface/viewport.h"
#include "intro.h"
#include "localisation/currency.h"
#include "localisation/localisation.h"
#include "network/http.h"
#include "network/network.h"
@ -260,6 +261,8 @@ bool openrct2_initialise()
}
}
currency_load_custom_currency_config();
return true;
}
@ -323,11 +326,6 @@ void openrct2_launch()
}
#endif // DISABLE_NETWORK
// Set custom currency properties
CurrencyDescriptors[CURRENCY_CUSTOM].rate = gConfigGeneral.custom_currency_rate;
CurrencyDescriptors[CURRENCY_CUSTOM].affix_unicode = gConfigGeneral.custom_currency_affix;
strncpy(CurrencyDescriptors[CURRENCY_CUSTOM].symbol_unicode, gConfigGeneral.custom_currency_symbol, CURRENCY_SYMBOL_MAX_SIZE);
openrct2_loop();
}
openrct2_dispose();