OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

currency.h
Go to the documentation of this file.
1 /* $Id: currency.h 25076 2013-03-09 16:31:56Z planetmaker $ */
2
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 */
9
12 #ifndef CURRENCY_H
13 #define CURRENCY_H
14
15 #include "date_type.h"
16 #include "strings_type.h"
17
18 static const int CF_NOEURO = 0;
19 static const int CF_ISEURO = 1;
20
26 enum Currencies {
27 CURRENCY_GBP,
28 CURRENCY_USD,
29 CURRENCY_EUR,
30 CURRENCY_JPY,
31 CURRENCY_ATS,
32 CURRENCY_BEF,
33 CURRENCY_CHF,
34 CURRENCY_CZK,
35 CURRENCY_DEM,
36 CURRENCY_DKK,
37 CURRENCY_ESP,
38 CURRENCY_FIM,
39 CURRENCY_FRF,
40 CURRENCY_GRD,
41 CURRENCY_HUF,
42 CURRENCY_ISK,
43 CURRENCY_ITL,
44 CURRENCY_NLG,
45 CURRENCY_NOK,
46 CURRENCY_PLN,
47 CURRENCY_RON,
48 CURRENCY_RUR,
49 CURRENCY_SIT,
50 CURRENCY_SEK,
51 CURRENCY_YTL,
52 CURRENCY_SKK,
53 CURRENCY_BRL,
54 CURRENCY_EEK,
55 CURRENCY_LTL,
56 CURRENCY_KRW,
57 CURRENCY_ZAR,
58 CURRENCY_CUSTOM,
59 CURRENCY_GEL,
60 CURRENCY_IRR,
61 CURRENCY_END,
62 };
63
65 struct CurrencySpec {
66 uint16 rate;
67 char separator[8];
68 Year to_euro;
69 char prefix[16];
70 char suffix[16];
80 byte symbol_pos;
81 StringID name;
82 };
83
84 extern CurrencySpec _currency_specs[CURRENCY_END];
85
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])
89
90 uint64 GetMaskOfAllowedCurrencies();
91 void CheckSwitchToEuro();
92 void ResetCurrencies(bool preserve_custom = true);
93 StringID *BuildCurrencyDropdown();
94 byte GetNewgrfCurrencyIdConverted(byte grfcurr_id);
95
96 #endif /* CURRENCY_H */