|
OpenTTD Source
14.0-beta3
|
#include "stdafx.h"#include "core/bitmath_func.hpp"#include "currency.h"#include "news_func.h"#include "settings_type.h"#include "string_type.h"#include "timer/timer.h"#include "timer/timer_game_calendar.h"#include "table/strings.h"#include "safeguards.h"Go to the source code of this file.
Functions | |
| byte | GetNewgrfCurrencyIdConverted (byte grfcurr_id) |
| Will return the ottd's index correspondence to the ttdpatch's id. More... | |
| uint64_t | GetMaskOfAllowedCurrencies () |
| get a mask of the allowed currencies depending on the year More... | |
| void | ResetCurrencies (bool preserve_custom) |
| Will fill _currency_specs array with default values from origin_currency_specs Called only from newgrf.cpp and settings.cpp. More... | |
Variables | |
| static const CurrencySpec | origin_currency_specs [CURRENCY_END] |
| The original currency specifications. | |
| CurrencySpec | _currency_specs [CURRENCY_END] |
| Array of currencies used by the system. | |
| const byte | TTDPatch_To_OTTDIndex [] |
| This array represent the position of OpenTTD's currencies, compared to TTDPatch's ones. More... | |
| static IntervalTimer< TimerGameCalendar > | _check_switch_to_euro ({TimerGameCalendar::YEAR, TimerGameCalendar::Priority::NONE}, [](auto) { if(_currency_specs[_settings_game.locale.currency].to_euro !=CF_NOEURO &&_currency_specs[_settings_game.locale.currency].to_euro !=CF_ISEURO &&TimerGameCalendar::year >=_currency_specs[_settings_game.locale.currency].to_euro) { _settings_game.locale.currency=2;AddNewsItem(STR_NEWS_EURO_INTRODUCTION, NT_ECONOMY, NF_NORMAL);} }) |
| Verify if the currency chosen by the user is about to be converted to Euro. | |
Support for different currencies.
Definition in file currency.cpp.
| uint64_t GetMaskOfAllowedCurrencies | ( | ) |
get a mask of the allowed currencies depending on the year
Definition at line 124 of file currency.cpp.
References _currency_specs, CF_ISEURO, CF_NOEURO, CURRENCY_CUSTOM, CURRENCY_END, SetBit(), CurrencySpec::to_euro, and TimerGameCalendar::year.
| byte GetNewgrfCurrencyIdConverted | ( | byte | grfcurr_id | ) |
Will return the ottd's index correspondence to the ttdpatch's id.
If the id is bigger than the array, it is a grf written for ottd, thus returning the same id. Only called from newgrf.cpp
| grfcurr_id | currency id coming from newgrf |
Definition at line 115 of file currency.cpp.
References lengthof, and TTDPatch_To_OTTDIndex.
| void ResetCurrencies | ( | bool | preserve_custom | ) |
Will fill _currency_specs array with default values from origin_currency_specs Called only from newgrf.cpp and settings.cpp.
| preserve_custom | will not reset custom currency |
Definition at line 159 of file currency.cpp.
References _currency_specs, CURRENCY_CUSTOM, CURRENCY_END, and origin_currency_specs.
Referenced by LoadFromConfig().
| const byte TTDPatch_To_OTTDIndex[] |
This array represent the position of OpenTTD's currencies, compared to TTDPatch's ones.
When a grf sends currencies, they are based on the order defined by TTDPatch. So, we must reindex them to our own order.
Definition at line 84 of file currency.cpp.
Referenced by GetNewgrfCurrencyIdConverted().