author | rubidium |
Thu, 01 Feb 2007 15:49:12 +0000 | |
changeset 5893 | 7e431a4abebb |
parent 5584 | 1111b4d36e35 |
child 6123 | 04eb770ec17e |
permissions | -rw-r--r-- |
2291
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
diff
changeset
|
1 |
/* $Id$ */ |
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
diff
changeset
|
2 |
|
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
diff
changeset
|
3 |
#include "stdafx.h" |
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
diff
changeset
|
4 |
#include "openttd.h" |
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
diff
changeset
|
5 |
#include "currency.h" |
2306
adb71c055afb
(svn r2830) Move CheckSwitchToEuro() to currency.[ch] and hide the truth about the custom currency behind a #define
tron
parents:
2291
diff
changeset
|
6 |
#include "news.h" |
2291
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
diff
changeset
|
7 |
#include "variables.h" |
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
diff
changeset
|
8 |
#include "table/strings.h" |
4261
28670f743746
(svn r5887) -Cleanup: move date related functions, defines and variables to date.[ch]
rubidium
parents:
4138
diff
changeset
|
9 |
#include "date.h" |
2291
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
diff
changeset
|
10 |
|
4377
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
11 |
// exchange rate prefix symbol_pos |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
12 |
// | separator | postfix | |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
13 |
// | | Euro year | | | name |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
14 |
// | | | | | | | |
5023 | 15 |
static const CurrencySpec origin_currency_specs[NUM_CURRENCY] = { |
5108
aeaef6fe53b7
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5092
diff
changeset
|
16 |
{ 1, ',', CF_NOEURO, "£", "", 0, STR_CURR_GBP }, // british pounds |
4377
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
17 |
{ 2, ',', CF_NOEURO, "$", "", 0, STR_CURR_USD }, // us dollars |
5108
aeaef6fe53b7
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5092
diff
changeset
|
18 |
{ 2, ',', CF_ISEURO, "€", "", 0, STR_CURR_EUR }, // Euro |
aeaef6fe53b7
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5092
diff
changeset
|
19 |
{ 220, ',', CF_NOEURO, "¥", "", 0, STR_CURR_YEN }, // yen |
5092
729d5844dc5b
(svn r7161) -Codechange: Update currency exchange rates... yes I'm bored ;p
Darkvater
parents:
5091
diff
changeset
|
20 |
{ 20, ',', 2002, "", " S.", 1, STR_CURR_ATS }, // austrian schilling |
729d5844dc5b
(svn r7161) -Codechange: Update currency exchange rates... yes I'm bored ;p
Darkvater
parents:
5091
diff
changeset
|
21 |
{ 59, ',', 2002, "BEF ", "", 0, STR_CURR_BEF }, // belgian franc |
4377
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
22 |
{ 2, ',', CF_NOEURO, "CHF ", "", 0, STR_CURR_CHF }, // swiss franc |
5108
aeaef6fe53b7
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5092
diff
changeset
|
23 |
{ 41, ',', CF_NOEURO, "", " Kč", 1, STR_CURR_CZK }, // czech koruna |
5092
729d5844dc5b
(svn r7161) -Codechange: Update currency exchange rates... yes I'm bored ;p
Darkvater
parents:
5091
diff
changeset
|
24 |
{ 3, '.', 2002, "DM ", "", 0, STR_CURR_DEM }, // deutsche mark |
729d5844dc5b
(svn r7161) -Codechange: Update currency exchange rates... yes I'm bored ;p
Darkvater
parents:
5091
diff
changeset
|
25 |
{ 11, '.', CF_NOEURO, "", " kr", 1, STR_CURR_DKK }, // danish krone |
729d5844dc5b
(svn r7161) -Codechange: Update currency exchange rates... yes I'm bored ;p
Darkvater
parents:
5091
diff
changeset
|
26 |
{ 245, '.', 2002, "Pts ", "", 0, STR_CURR_ESP }, // spanish pesetas |
729d5844dc5b
(svn r7161) -Codechange: Update currency exchange rates... yes I'm bored ;p
Darkvater
parents:
5091
diff
changeset
|
27 |
{ 9, ',', 2002, "", " mk", 1, STR_CURR_FIM }, // finnish markka |
4377
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
28 |
{ 10, '.', 2002, "FF ", "", 0, STR_CURR_FRF }, // french francs |
5092
729d5844dc5b
(svn r7161) -Codechange: Update currency exchange rates... yes I'm bored ;p
Darkvater
parents:
5091
diff
changeset
|
29 |
{ 500, ',', 2002, "", "Dr.", 1, STR_CURR_GRD }, // greek drachma |
729d5844dc5b
(svn r7161) -Codechange: Update currency exchange rates... yes I'm bored ;p
Darkvater
parents:
5091
diff
changeset
|
30 |
{ 378, ',', 2010, "", " Ft", 1, STR_CURR_HUF }, // hungarian forint |
4377
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
31 |
{ 130, '.', CF_NOEURO, "", " Kr", 1, STR_CURR_ISK }, // icelandic krona |
5092
729d5844dc5b
(svn r7161) -Codechange: Update currency exchange rates... yes I'm bored ;p
Darkvater
parents:
5091
diff
changeset
|
32 |
{ 2850, ',', 2002, "", " L.", 1, STR_CURR_ITL }, // italian lira |
4377
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
33 |
{ 3, ',', 2002, "NLG ", "", 0, STR_CURR_NLG }, // dutch gulden |
5092
729d5844dc5b
(svn r7161) -Codechange: Update currency exchange rates... yes I'm bored ;p
Darkvater
parents:
5091
diff
changeset
|
34 |
{ 12, '.', CF_NOEURO, "", " Kr", 1, STR_CURR_NOK }, // norwegian krone |
4377
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
35 |
{ 6, ' ', CF_NOEURO, "", " zl", 1, STR_CURR_PLN }, // polish zloty |
5092
729d5844dc5b
(svn r7161) -Codechange: Update currency exchange rates... yes I'm bored ;p
Darkvater
parents:
5091
diff
changeset
|
36 |
{ 5, '.', CF_NOEURO, "", " Lei", 1, STR_CURR_ROL }, // romanian Lei |
729d5844dc5b
(svn r7161) -Codechange: Update currency exchange rates... yes I'm bored ;p
Darkvater
parents:
5091
diff
changeset
|
37 |
{ 50, ' ', CF_NOEURO, "", " p", 1, STR_CURR_RUR }, // russian rouble |
729d5844dc5b
(svn r7161) -Codechange: Update currency exchange rates... yes I'm bored ;p
Darkvater
parents:
5091
diff
changeset
|
38 |
{ 352, '.', CF_NOEURO, "", " SIT", 1, STR_CURR_SIT }, // slovenian tolar |
4377
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
39 |
{ 13, '.', CF_NOEURO, "", " Kr", 1, STR_CURR_SEK }, // swedish krona |
5092
729d5844dc5b
(svn r7161) -Codechange: Update currency exchange rates... yes I'm bored ;p
Darkvater
parents:
5091
diff
changeset
|
40 |
{ 3, '.', CF_NOEURO, "", " YTL", 1, STR_CURR_YTL }, // turkish lira |
729d5844dc5b
(svn r7161) -Codechange: Update currency exchange rates... yes I'm bored ;p
Darkvater
parents:
5091
diff
changeset
|
41 |
{ 52, ',', CF_NOEURO, "", " Sk", 1, STR_CURR_SKK }, // slovak koruna |
729d5844dc5b
(svn r7161) -Codechange: Update currency exchange rates... yes I'm bored ;p
Darkvater
parents:
5091
diff
changeset
|
42 |
{ 4, ',', CF_NOEURO, "R$ ", "", 0, STR_CURR_BRR }, // brazil real |
4602
43c44f7df615
(svn r6454) -Fix(r6108) : Allow custom currency to display both prefix and suffix
belugas
parents:
4601
diff
changeset
|
43 |
{ 1, ' ', CF_NOEURO, "", "", 2, STR_CURR_CUSTOM }, // custom currency |
2291
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
diff
changeset
|
44 |
}; |
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
diff
changeset
|
45 |
|
4377
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
46 |
/* Array of currencies used by the system */ |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
47 |
CurrencySpec _currency_specs[NUM_CURRENCY]; |
2291
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
diff
changeset
|
48 |
|
4625
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
49 |
/** |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
50 |
* These enums are only declared in order to make sens |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
51 |
* out of the TTDPatch_To_OTTDIndex array that will follow |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
52 |
* Every currency used by Ottd is there, just in case TTDPatch will |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
53 |
* add those missing in its code |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
54 |
**/ |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
55 |
enum { |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
56 |
CURR_GBP, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
57 |
CURR_USD, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
58 |
CURR_EUR, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
59 |
CURR_YEN, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
60 |
CURR_ATS, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
61 |
CURR_BEF, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
62 |
CURR_CHF, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
63 |
CURR_CZK, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
64 |
CURR_DEM, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
65 |
CURR_DKK, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
66 |
CURR_ESP, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
67 |
CURR_FIM, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
68 |
CURR_FRF, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
69 |
CURR_GRD, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
70 |
CURR_HUF, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
71 |
CURR_ISK, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
72 |
CURR_ITL, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
73 |
CURR_NLG, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
74 |
CURR_NOK, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
75 |
CURR_PLN, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
76 |
CURR_ROL, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
77 |
CURR_RUR, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
78 |
CURR_SIT, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
79 |
CURR_SEK, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
80 |
CURR_YTL, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
81 |
}; |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
82 |
|
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
83 |
/** |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
84 |
* This array represent the position of OpenTTD's currencies, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
85 |
* compared to TTDPatch's ones. |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
86 |
* When a grf sends currencies, they are based on the order defined by TTDPatch. |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
87 |
* So, we must reindex them to our own order. |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
88 |
**/ |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
89 |
const byte TTDPatch_To_OTTDIndex[] = |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
90 |
{ |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
91 |
CURR_GBP, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
92 |
CURR_USD, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
93 |
CURR_FRF, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
94 |
CURR_DEM, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
95 |
CURR_YEN, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
96 |
CURR_ESP, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
97 |
CURR_HUF, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
98 |
CURR_PLN, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
99 |
CURR_ATS, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
100 |
CURR_BEF, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
101 |
CURR_DKK, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
102 |
CURR_FIM, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
103 |
CURR_GRD, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
104 |
CURR_CHF, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
105 |
CURR_NLG, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
106 |
CURR_ITL, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
107 |
CURR_SEK, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
108 |
CURR_RUR, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
109 |
CURR_EUR, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
110 |
}; |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
111 |
|
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
112 |
/** |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
113 |
* Will return the ottd's index correspondance to |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
114 |
* the ttdpatch's id. If the id is bigger then the array, |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
115 |
* it is a grf written for ottd, thus returning the same id. |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
116 |
* Only called from newgrf.c |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
117 |
* @param grfcurr_id currency id coming from newgrf |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
118 |
* @return the corrected index |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
119 |
**/ |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
120 |
byte GetNewgrfCurrencyIdConverted(byte grfcurr_id) |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
121 |
{ |
4626
ce414b54bfc3
(svn r6486) -Fix (r6485): wrong variable name used in GetNewgrfCurrencyIdConverted()
glx
parents:
4625
diff
changeset
|
122 |
return (grfcurr_id >= lengthof(TTDPatch_To_OTTDIndex)) ? grfcurr_id : TTDPatch_To_OTTDIndex[grfcurr_id]; |
4625
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
123 |
} |
f365b341a330
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
belugas
parents:
4602
diff
changeset
|
124 |
|
4377
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
125 |
/* get a mask of the allowed currencies depending on the year */ |
2291
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
diff
changeset
|
126 |
uint GetMaskOfAllowedCurrencies(void) |
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
diff
changeset
|
127 |
{ |
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
diff
changeset
|
128 |
uint mask = 0; |
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
diff
changeset
|
129 |
uint i; |
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
diff
changeset
|
130 |
|
4377
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
131 |
for (i = 0; i < NUM_CURRENCY; i++) { |
4297
d0311b62255c
(svn r5934) -Cleanup: forgot some conversions to Year and to Date
rubidium
parents:
4293
diff
changeset
|
132 |
Year to_euro = _currency_specs[i].to_euro; |
2291
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
diff
changeset
|
133 |
|
4293
4b7006c1b5eb
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents:
4286
diff
changeset
|
134 |
if (to_euro != CF_NOEURO && to_euro != CF_ISEURO && _cur_year >= to_euro) continue; |
4b7006c1b5eb
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents:
4286
diff
changeset
|
135 |
if (to_euro == CF_ISEURO && _cur_year < 2000) continue; |
2291
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
diff
changeset
|
136 |
mask |= (1 << i); |
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
diff
changeset
|
137 |
} |
3596
6654541a3958
(svn r4487) - Codechange: replace the custom currency magic number 23 with a define
peter1138
parents:
2495
diff
changeset
|
138 |
mask |= (1 << CUSTOM_CURRENCY_ID); // always allow custom currency |
2291
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
diff
changeset
|
139 |
return mask; |
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
diff
changeset
|
140 |
} |
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
diff
changeset
|
141 |
|
4377
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
142 |
/** |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
143 |
* Verify if the currency chosen by the user is about to be converted to Euro |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
144 |
**/ |
2306
adb71c055afb
(svn r2830) Move CheckSwitchToEuro() to currency.[ch] and hide the truth about the custom currency behind a #define
tron
parents:
2291
diff
changeset
|
145 |
void CheckSwitchToEuro(void) |
adb71c055afb
(svn r2830) Move CheckSwitchToEuro() to currency.[ch] and hide the truth about the custom currency behind a #define
tron
parents:
2291
diff
changeset
|
146 |
{ |
adb71c055afb
(svn r2830) Move CheckSwitchToEuro() to currency.[ch] and hide the truth about the custom currency behind a #define
tron
parents:
2291
diff
changeset
|
147 |
if (_currency_specs[_opt.currency].to_euro != CF_NOEURO && |
adb71c055afb
(svn r2830) Move CheckSwitchToEuro() to currency.[ch] and hide the truth about the custom currency behind a #define
tron
parents:
2291
diff
changeset
|
148 |
_currency_specs[_opt.currency].to_euro != CF_ISEURO && |
4293
4b7006c1b5eb
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents:
4286
diff
changeset
|
149 |
_cur_year >= _currency_specs[_opt.currency].to_euro) { |
2306
adb71c055afb
(svn r2830) Move CheckSwitchToEuro() to currency.[ch] and hide the truth about the custom currency behind a #define
tron
parents:
2291
diff
changeset
|
150 |
_opt.currency = 2; // this is the index of euro above. |
adb71c055afb
(svn r2830) Move CheckSwitchToEuro() to currency.[ch] and hide the truth about the custom currency behind a #define
tron
parents:
2291
diff
changeset
|
151 |
AddNewsItem(STR_EURO_INTRODUCE, NEWS_FLAGS(NM_NORMAL, 0, NT_ECONOMY, 0), 0, 0); |
adb71c055afb
(svn r2830) Move CheckSwitchToEuro() to currency.[ch] and hide the truth about the custom currency behind a #define
tron
parents:
2291
diff
changeset
|
152 |
} |
adb71c055afb
(svn r2830) Move CheckSwitchToEuro() to currency.[ch] and hide the truth about the custom currency behind a #define
tron
parents:
2291
diff
changeset
|
153 |
} |
4138
8640f25e2510
(svn r5496) -CodeChange: Removed two compiler warnings
belugas
parents:
3596
diff
changeset
|
154 |
|
4377
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
155 |
/** |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
156 |
* Called only from newgrf.c. Will fill _currency_specs array with |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
157 |
* default values from origin_currency_specs |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
158 |
**/ |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
159 |
void ResetCurrencies(void) |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
160 |
{ |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
161 |
memcpy(&_currency_specs, &origin_currency_specs, sizeof(origin_currency_specs)); |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
162 |
} |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
163 |
|
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
164 |
/** |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
165 |
* Build a list of currency names StringIDs to use in a dropdown list |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
166 |
* @return Pointer to a (static) array of StringIDs |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
167 |
*/ |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
168 |
StringID* BuildCurrencyDropdown(void) |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
169 |
{ |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
170 |
/* Allow room for all currencies, plus a terminator entry */ |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
171 |
static StringID names[CUSTOM_CURRENCY_ID]; |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
172 |
uint i; |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
173 |
|
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
174 |
/* Add each name */ |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
175 |
for (i = 0; i < NUM_CURRENCY; i++) { |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
176 |
names[i] = _currency_specs[i].name; |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
177 |
} |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
178 |
/* Terminate the list */ |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
179 |
names[i] = INVALID_STRING_ID; |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
180 |
|
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
181 |
return names; |
f04bcf6f9a04
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
belugas
parents:
4311
diff
changeset
|
182 |
} |