Fix: [OSX] Don't show a crash/assertion message box for a GUI-less video driver.
[openttd-github.git] / src / currency.h
blob58c385a8b44772591c4b513311e3c44ad5be5b18
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 */
8 /** @file currency.h Functions to handle different currencies. */
10 #ifndef CURRENCY_H
11 #define CURRENCY_H
13 #include "date_type.h"
14 #include "strings_type.h"
16 static const int CF_NOEURO = 0; ///< Currency never switches to the Euro (as far as known).
17 static const int CF_ISEURO = 1; ///< Currency _is_ the Euro.
19 /**
20 * This enum gives the currencies a unique id which must be maintained for
21 * savegame compatibility and in order to refer to them quickly, especially
22 * for referencing the custom one.
24 enum Currencies {
25 CURRENCY_GBP, ///< British Pound
26 CURRENCY_USD, ///< US Dollar
27 CURRENCY_EUR, ///< Euro
28 CURRENCY_JPY, ///< Japanese Yen
29 CURRENCY_ATS, ///< Austrian Schilling
30 CURRENCY_BEF, ///< Belgian Franc
31 CURRENCY_CHF, ///< Swiss Franc
32 CURRENCY_CZK, ///< Czech Koruna
33 CURRENCY_DEM, ///< Deutsche Mark
34 CURRENCY_DKK, ///< Danish Krona
35 CURRENCY_ESP, ///< Spanish Peseta
36 CURRENCY_FIM, ///< Finish Markka
37 CURRENCY_FRF, ///< French Franc
38 CURRENCY_GRD, ///< Greek Drachma
39 CURRENCY_HUF, ///< Hungarian Forint
40 CURRENCY_ISK, ///< Icelandic Krona
41 CURRENCY_ITL, ///< Italian Lira
42 CURRENCY_NLG, ///< Dutch Gulden
43 CURRENCY_NOK, ///< Norwegian Krone
44 CURRENCY_PLN, ///< Polish Zloty
45 CURRENCY_RON, ///< Romenian Leu
46 CURRENCY_RUR, ///< Russian Rouble
47 CURRENCY_SIT, ///< Slovenian Tolar
48 CURRENCY_SEK, ///< Swedish Krona
49 CURRENCY_YTL, ///< Turkish Lira
50 CURRENCY_SKK, ///< Slovak Kornuna
51 CURRENCY_BRL, ///< Brazilian Real
52 CURRENCY_EEK, ///< Estonian Krooni
53 CURRENCY_LTL, ///< Lithuanian Litas
54 CURRENCY_KRW, ///< South Korean Won
55 CURRENCY_ZAR, ///< South African Rand
56 CURRENCY_CUSTOM, ///< Custom currency
57 CURRENCY_GEL, ///< Georgian Lari
58 CURRENCY_IRR, ///< Iranian Rial
59 CURRENCY_RUB, ///< New Russian Ruble
60 CURRENCY_MXN, ///< Mexican Peso
61 CURRENCY_NTD, ///< New Taiwan Dollar
62 CURRENCY_CNY, ///< Chinese Renminbi
63 CURRENCY_HKD, ///< Hong Kong Dollar
64 CURRENCY_END, ///< always the last item
67 /** Specification of a currency. */
68 struct CurrencySpec {
69 uint16 rate;
70 char separator[8];
71 Year to_euro; ///< %Year of switching to the Euro. May also be #CF_NOEURO or #CF_ISEURO.
72 char prefix[16];
73 char suffix[16];
74 /**
75 * The currency symbol is represented by two possible values, prefix and suffix
76 * Usage of one or the other is determined by #symbol_pos.
77 * 0 = prefix
78 * 1 = suffix
79 * 2 = both : Special case only for custom currency.
80 * It is not a spec from Newgrf,
81 * rather a way to let users do what they want with custom currency
83 byte symbol_pos;
84 StringID name;
87 extern CurrencySpec _currency_specs[CURRENCY_END];
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])
93 uint64 GetMaskOfAllowedCurrencies();
94 void CheckSwitchToEuro();
95 void ResetCurrencies(bool preserve_custom = true);
96 StringID *BuildCurrencyDropdown();
97 byte GetNewgrfCurrencyIdConverted(byte grfcurr_id);
99 #endif /* CURRENCY_H */