OpenTTD
currency.h
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6  */
7 
10 #ifndef CURRENCY_H
11 #define CURRENCY_H
12 
13 #include "date_type.h"
14 #include "strings_type.h"
15 
16 static const int CF_NOEURO = 0;
17 static const int CF_ISEURO = 1;
18 
24 enum Currencies {
65 };
66 
68 struct CurrencySpec {
69  uint16 rate;
70  char separator[8];
72  char prefix[16];
73  char suffix[16];
83  byte symbol_pos;
84  StringID name;
85 };
86 
88 
89 /* XXX small hack, but makes the rest of the code a bit nicer to read */
90 #define _custom_currency (_currency_specs[CURRENCY_CUSTOM])
91 #define _currency ((const CurrencySpec*)&_currency_specs[GetGameSettings().locale.currency])
92 
94 void CheckSwitchToEuro();
95 void ResetCurrencies(bool preserve_custom = true);
97 byte GetNewgrfCurrencyIdConverted(byte grfcurr_id);
98 
99 #endif /* CURRENCY_H */
Russian Rouble.
Definition: currency.h:46
Finish Markka.
Definition: currency.h:36
Italian Lira.
Definition: currency.h:41
Dutch Gulden.
Definition: currency.h:42
Custom currency.
Definition: currency.h:56
Icelandic Krona.
Definition: currency.h:40
Euro.
Definition: currency.h:27
South Korean Won.
Definition: currency.h:54
Brazilian Real.
Definition: currency.h:51
Chinese Renminbi.
Definition: currency.h:62
int32 Year
Type for the year, note: 0 based, i.e. starts at the year 0.
Definition: date_type.h:18
uint64 GetMaskOfAllowedCurrencies()
get a mask of the allowed currencies depending on the year
Definition: currency.cpp:119
Japanese Yen.
Definition: currency.h:28
Estonian Krooni.
Definition: currency.h:52
Slovak Kornuna.
Definition: currency.h:50
byte symbol_pos
The currency symbol is represented by two possible values, prefix and suffix Usage of one or the othe...
Definition: currency.h:83
US Dollar.
Definition: currency.h:26
New Taiwan Dollar.
Definition: currency.h:61
void CheckSwitchToEuro()
Verify if the currency chosen by the user is about to be converted to Euro.
Definition: currency.cpp:138
Turkish Lira.
Definition: currency.h:49
Danish Krona.
Definition: currency.h:34
Currencies
This enum gives the currencies a unique id which must be maintained for savegame compatibility and in...
Definition: currency.h:24
CurrencySpec _currency_specs[CURRENCY_END]
Array of currencies used by the system.
Definition: currency.cpp:71
New Russian Ruble.
Definition: currency.h:59
static const int CF_NOEURO
Currency never switches to the Euro (as far as known).
Definition: currency.h:16
Spanish Peseta.
Definition: currency.h:35
Swedish Krona.
Definition: currency.h:48
Hong Kong Dollar.
Definition: currency.h:63
British Pound.
Definition: currency.h:25
Romenian Leu.
Definition: currency.h:45
Belgian Franc.
Definition: currency.h:30
always the last item
Definition: currency.h:64
Czech Koruna.
Definition: currency.h:32
void ResetCurrencies(bool preserve_custom=true)
Will fill _currency_specs array with default values from origin_currency_specs Called only from newgr...
Definition: currency.cpp:154
Greek Drachma.
Definition: currency.h:38
French Franc.
Definition: currency.h:37
Norwegian Krone.
Definition: currency.h:43
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:16
Year to_euro
Year of switching to the Euro. May also be CF_NOEURO or CF_ISEURO.
Definition: currency.h:71
StringID * BuildCurrencyDropdown()
Build a list of currency names StringIDs to use in a dropdown list.
Definition: currency.cpp:166
Lithuanian Litas.
Definition: currency.h:53
Austrian Schilling.
Definition: currency.h:29
Polish Zloty.
Definition: currency.h:44
Iranian Rial.
Definition: currency.h:58
Slovenian Tolar.
Definition: currency.h:47
Mexican Peso.
Definition: currency.h:60
Specification of a currency.
Definition: currency.h:68
Georgian Lari.
Definition: currency.h:57
South African Rand.
Definition: currency.h:55
Types related to strings.
Types related to the dates in OpenTTD.
static const int CF_ISEURO
Currency is the Euro.
Definition: currency.h:17
Swiss Franc.
Definition: currency.h:31
Deutsche Mark.
Definition: currency.h:33
byte GetNewgrfCurrencyIdConverted(byte grfcurr_id)
Will return the ottd&#39;s index correspondence to the ttdpatch&#39;s id.
Definition: currency.cpp:110
Hungarian Forint.
Definition: currency.h:39