Maintain a circular buffer of recent commands, add to crashlog.
[openttd-joker.git] / src / currency.h
blob518eb45cda683e701800abe208ce2013731785ab
1 /* $Id: currency.h 25076 2013-03-09 16:31:56Z planetmaker $ */
3 /*
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
8 */
10 /** @file currency.h Functions to handle different currencies. */
12 #ifndef CURRENCY_H
13 #define CURRENCY_H
15 #include "date_type.h"
16 #include "strings_type.h"
18 static const int CF_NOEURO = 0; ///< Currency never switches to the Euro (as far as known).
19 static const int CF_ISEURO = 1; ///< Currency _is_ the Euro.
21 /**
22 * This enum gives the currencies a unique id which must be maintained for
23 * savegame compatibility and in order to refer to them quickly, especially
24 * for referencing the custom one.
26 enum Currencies {
27 CURRENCY_GBP, ///< British Pound
28 CURRENCY_USD, ///< US Dollar
29 CURRENCY_EUR, ///< Euro
30 CURRENCY_JPY, ///< Japanese Yen
31 CURRENCY_ATS, ///< Austrian Schilling
32 CURRENCY_BEF, ///< Belgian Franc
33 CURRENCY_CHF, ///< Swiss Franc
34 CURRENCY_CZK, ///< Czech Koruna
35 CURRENCY_DEM, ///< Deutsche Mark
36 CURRENCY_DKK, ///< Danish Krona
37 CURRENCY_ESP, ///< Spanish Peseta
38 CURRENCY_FIM, ///< Finish Markka
39 CURRENCY_FRF, ///< French Franc
40 CURRENCY_GRD, ///< Greek Drachma
41 CURRENCY_HUF, ///< Hungarian Forint
42 CURRENCY_ISK, ///< Icelandic Krona
43 CURRENCY_ITL, ///< Italian Lira
44 CURRENCY_NLG, ///< Dutch Gulden
45 CURRENCY_NOK, ///< Norwegian Krone
46 CURRENCY_PLN, ///< Polish Zloty
47 CURRENCY_RON, ///< Romenian Leu
48 CURRENCY_RUR, ///< Russian Rouble
49 CURRENCY_SIT, ///< Slovenian Tolar
50 CURRENCY_SEK, ///< Swedish Krona
51 CURRENCY_YTL, ///< Turkish Lira
52 CURRENCY_SKK, ///< Slovak Kornuna
53 CURRENCY_BRL, ///< Brazilian Real
54 CURRENCY_EEK, ///< Estonian Krooni
55 CURRENCY_LTL, ///< Lithuanian Litas
56 CURRENCY_KRW, ///< South Korean Won
57 CURRENCY_ZAR, ///< South African Rand
58 CURRENCY_CUSTOM, ///< Custom currency
59 CURRENCY_GEL, ///< Georgian Lari
60 CURRENCY_IRR, ///< Iranian Rial
61 CURRENCY_END, ///< always the last item
64 /** Specification of a currency. */
65 struct CurrencySpec {
66 uint16 rate;
67 char separator[8];
68 Year to_euro; ///< %Year of switching to the Euro. May also be #CF_NOEURO or #CF_ISEURO.
69 char prefix[16];
70 char suffix[16];
71 /**
72 * The currency symbol is represented by two possible values, prefix and suffix
73 * Usage of one or the other is determined by #symbol_pos.
74 * 0 = prefix
75 * 1 = suffix
76 * 2 = both : Special case only for custom currency.
77 * It is not a spec from Newgrf,
78 * rather a way to let users do what they want with custom currency
80 byte symbol_pos;
81 StringID name;
84 extern CurrencySpec _currency_specs[CURRENCY_END];
86 /* XXX small hack, but makes the rest of the code a bit nicer to read */
87 #define _custom_currency (_currency_specs[CURRENCY_CUSTOM])
88 #define _currency ((const CurrencySpec*)&_currency_specs[GetGameSettings().locale.currency])
90 uint64 GetMaskOfAllowedCurrencies();
91 void CheckSwitchToEuro();
92 void ResetCurrencies(bool preserve_custom = true);
93 StringID *BuildCurrencyDropdown();
94 byte GetNewgrfCurrencyIdConverted(byte grfcurr_id);
96 #endif /* CURRENCY_H */