Codechange: Replace currency macros with functions. (#12396)
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
#define CURRENCY_H
|
||||
|
||||
#include "timer/timer_game_calendar.h"
|
||||
#include "string_func.h"
|
||||
#include "settings_type.h"
|
||||
#include "strings_type.h"
|
||||
|
||||
static constexpr TimerGameCalendar::Year CF_NOEURO = 0; ///< Currency never switches to the Euro (as far as known).
|
||||
@@ -99,11 +99,25 @@ struct CurrencySpec {
|
||||
}
|
||||
};
|
||||
|
||||
extern CurrencySpec _currency_specs[CURRENCY_END];
|
||||
extern std::array<CurrencySpec, CURRENCY_END> _currency_specs;
|
||||
|
||||
/* XXX small hack, but makes the rest of the code a bit nicer to read */
|
||||
#define _custom_currency (_currency_specs[CURRENCY_CUSTOM])
|
||||
#define _currency ((const CurrencySpec*)&_currency_specs[GetGameSettings().locale.currency])
|
||||
/**
|
||||
* Get the custom currency.
|
||||
* @return Reference to custom currency.
|
||||
*/
|
||||
inline CurrencySpec &GetCustomCurrency()
|
||||
{
|
||||
return _currency_specs[CURRENCY_CUSTOM];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the currently selected currency.
|
||||
* @return Read-only reference to the current currency.
|
||||
*/
|
||||
inline const CurrencySpec &GetCurrency()
|
||||
{
|
||||
return _currency_specs[GetGameSettings().locale.currency];
|
||||
}
|
||||
|
||||
uint64_t GetMaskOfAllowedCurrencies();
|
||||
void ResetCurrencies(bool preserve_custom = true);
|
||||
|
||||
Reference in New Issue
Block a user