| author | egladil | 
| Sat, 29 Dec 2007 05:15:13 +0000 | |
| changeset 8652 | e06732646b8a | 
| parent 8636 | 2b158acb649c | 
| child 8760 | ce0891c412ce | 
| child 9724 | b39bc69bb2f2 | 
| permissions | -rw-r--r-- | 
| 2186 | 1  | 
/* $Id$ */  | 
2  | 
||
| 
6449
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
3  | 
/** @file currency.cpp **/  | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
4  | 
|
| 
2291
 
2b064aa97f91
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
 
tron 
parents: 
2186 
diff
changeset
 | 
5  | 
#include "stdafx.h"  | 
| 
 
2b064aa97f91
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
 
tron 
parents: 
2186 
diff
changeset
 | 
6  | 
#include "openttd.h"  | 
| 
 
2b064aa97f91
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
 
tron 
parents: 
2186 
diff
changeset
 | 
7  | 
#include "currency.h"  | 
| 
2306
 
3d4efe849dd9
(svn r2830) Move CheckSwitchToEuro() to currency.[ch] and hide the truth about the custom currency behind a #define
 
tron 
parents: 
2291 
diff
changeset
 | 
8  | 
#include "news.h"  | 
| 
2291
 
2b064aa97f91
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
 
tron 
parents: 
2186 
diff
changeset
 | 
9  | 
#include "variables.h"  | 
| 
 
2b064aa97f91
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
 
tron 
parents: 
2186 
diff
changeset
 | 
10  | 
#include "table/strings.h"  | 
| 
8636
 
2b158acb649c
(svn r11702) -Codechange: move all date related stuff to date*.
 
rubidium 
parents: 
6705 
diff
changeset
 | 
11  | 
#include "date_func.h"  | 
| 
2291
 
2b064aa97f91
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
 
tron 
parents: 
2186 
diff
changeset
 | 
12  | 
|
| 
4377
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
13  | 
// exchange rate prefix symbol_pos  | 
| 
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
14  | 
// | separator | postfix |  | 
| 
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
15  | 
// | | Euro year | | | name  | 
| 
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
16  | 
// | | | | | | |  | 
| 5023 | 17  | 
static const CurrencySpec origin_currency_specs[NUM_CURRENCY] = {
 | 
| 
6449
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
18  | 
	{    1, ',', CF_NOEURO, "£",    "",      0,  STR_CURR_GBP    }, ///< british pounds
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
19  | 
	{    2, ',', CF_NOEURO, "$",    "",      0,  STR_CURR_USD    }, ///< us dollars
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
20  | 
	{    2, ',', CF_ISEURO, "€",    "",      0,  STR_CURR_EUR    }, ///< Euro
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
21  | 
	{  220, ',', CF_NOEURO, "¥",    "",      0,  STR_CURR_YEN    }, ///< yen
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
22  | 
	{   20, ',', 2002,      "",     " S.",   1,  STR_CURR_ATS    }, ///< austrian schilling
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
23  | 
	{   59, ',', 2002,      "BEF ", "",      0,  STR_CURR_BEF    }, ///< belgian franc
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
24  | 
	{    2, ',', CF_NOEURO, "CHF ", "",      0,  STR_CURR_CHF    }, ///< swiss franc
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
25  | 
	{   41, ',', CF_NOEURO, "",     " Kč",   1,  STR_CURR_CZK    }, ///< czech koruna
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
26  | 
	{    3, '.', 2002,      "DM ",  "",      0,  STR_CURR_DEM    }, ///< deutsche mark
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
27  | 
	{   11, '.', CF_NOEURO, "",     " kr",   1,  STR_CURR_DKK    }, ///< danish krone
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
28  | 
	{  245, '.', 2002,      "Pts ", "",      0,  STR_CURR_ESP    }, ///< spanish pesetas
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
29  | 
	{    9, ',', 2002,      "",     " mk",   1,  STR_CURR_FIM    }, ///< finnish markka
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
30  | 
	{   10, '.', 2002,      "FF ",  "",      0,  STR_CURR_FRF    }, ///< french francs
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
31  | 
	{  500, ',', 2002,      "",     "Dr.",   1,  STR_CURR_GRD    }, ///< greek drachma
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
32  | 
	{  378, ',', 2010,      "",     " Ft",   1,  STR_CURR_HUF    }, ///< hungarian forint
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
33  | 
	{  130, '.', CF_NOEURO, "",     " Kr",   1,  STR_CURR_ISK    }, ///< icelandic krona
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
34  | 
	{ 2850, ',', 2002,      "",     " L.",   1,  STR_CURR_ITL    }, ///< italian lira
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
35  | 
	{    3, ',', 2002,      "NLG ", "",      0,  STR_CURR_NLG    }, ///< dutch gulden
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
36  | 
	{   12, '.', CF_NOEURO, "",     " Kr",   1,  STR_CURR_NOK    }, ///< norwegian krone
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
37  | 
	{    6, ' ', CF_NOEURO, "",     " zl",   1,  STR_CURR_PLN    }, ///< polish zloty
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
38  | 
	{    5, '.', CF_NOEURO, "",     " Lei",  1,  STR_CURR_ROL    }, ///< romanian Lei
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
39  | 
	{   50, ' ', CF_NOEURO, "",     " p",    1,  STR_CURR_RUR    }, ///< russian rouble
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
40  | 
	{  352, '.', CF_NOEURO, "",     " SIT",  1,  STR_CURR_SIT    }, ///< slovenian tolar
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
41  | 
	{   13, '.', CF_NOEURO, "",     " Kr",   1,  STR_CURR_SEK    }, ///< swedish krona
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
42  | 
	{    3, '.', CF_NOEURO, "",     " YTL",  1,  STR_CURR_YTL    }, ///< turkish lira
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
43  | 
	{   52, ',', CF_NOEURO, "",     " Sk",   1,  STR_CURR_SKK    }, ///< slovak koruna
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
44  | 
	{    4, ',', CF_NOEURO, "R$ ",  "",      0,  STR_CURR_BRR    }, ///< brazil real
 | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
45  | 
	{    1, ' ', CF_NOEURO, "",     "",      2,  STR_CURR_CUSTOM }, ///< custom currency
 | 
| 
759
 
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
 
dominik 
parents:  
diff
changeset
 | 
46  | 
};  | 
| 
768
 
deb40d3554a2
(svn r1233) Fixed several currency issues. Now currencies should work correctly again.
 
dominik 
parents: 
762 
diff
changeset
 | 
47  | 
|
| 
4377
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
48  | 
/* Array of currencies used by the system */  | 
| 
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
49  | 
CurrencySpec _currency_specs[NUM_CURRENCY];  | 
| 
2291
 
2b064aa97f91
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
 
tron 
parents: 
2186 
diff
changeset
 | 
50  | 
|
| 
4625
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
51  | 
/**  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
52  | 
* These enums are only declared in order to make sens  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
53  | 
* out of the TTDPatch_To_OTTDIndex array that will follow  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
54  | 
* Every currency used by Ottd is there, just in case TTDPatch will  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
55  | 
* add those missing in its code  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
56  | 
**/  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
57  | 
enum {
 | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
58  | 
CURR_GBP,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
59  | 
CURR_USD,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
60  | 
CURR_EUR,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
61  | 
CURR_YEN,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
62  | 
CURR_ATS,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
63  | 
CURR_BEF,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
64  | 
CURR_CHF,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
65  | 
CURR_CZK,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
66  | 
CURR_DEM,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
67  | 
CURR_DKK,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
68  | 
CURR_ESP,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
69  | 
CURR_FIM,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
70  | 
CURR_FRF,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
71  | 
CURR_GRD,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
72  | 
CURR_HUF,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
73  | 
CURR_ISK,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
74  | 
CURR_ITL,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
75  | 
CURR_NLG,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
76  | 
CURR_NOK,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
77  | 
CURR_PLN,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
78  | 
CURR_ROL,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
79  | 
CURR_RUR,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
80  | 
CURR_SIT,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
81  | 
CURR_SEK,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
82  | 
CURR_YTL,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
83  | 
};  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
84  | 
|
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
85  | 
/**  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
86  | 
* This array represent the position of OpenTTD's currencies,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
87  | 
* compared to TTDPatch's ones.  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
88  | 
* When a grf sends currencies, they are based on the order defined by TTDPatch.  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
89  | 
* So, we must reindex them to our own order.  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
90  | 
**/  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
91  | 
const byte TTDPatch_To_OTTDIndex[] =  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
92  | 
{
 | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
93  | 
CURR_GBP,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
94  | 
CURR_USD,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
95  | 
CURR_FRF,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
96  | 
CURR_DEM,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
97  | 
CURR_YEN,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
98  | 
CURR_ESP,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
99  | 
CURR_HUF,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
100  | 
CURR_PLN,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
101  | 
CURR_ATS,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
102  | 
CURR_BEF,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
103  | 
CURR_DKK,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
104  | 
CURR_FIM,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
105  | 
CURR_GRD,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
106  | 
CURR_CHF,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
107  | 
CURR_NLG,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
108  | 
CURR_ITL,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
109  | 
CURR_SEK,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
110  | 
CURR_RUR,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
111  | 
CURR_EUR,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
112  | 
};  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
113  | 
|
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
114  | 
/**  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
115  | 
* Will return the ottd's index correspondance to  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
116  | 
* the ttdpatch's id. If the id is bigger then the array,  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
117  | 
* it is a grf written for ottd, thus returning the same id.  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
118  | 
* Only called from newgrf.c  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
119  | 
* @param grfcurr_id currency id coming from newgrf  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
120  | 
* @return the corrected index  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
121  | 
**/  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
122  | 
byte GetNewgrfCurrencyIdConverted(byte grfcurr_id)  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
123  | 
{
 | 
| 
4626
 
a8e20b5d9d62
(svn r6486) -Fix (r6485): wrong variable name used in GetNewgrfCurrencyIdConverted()
 
glx 
parents: 
4625 
diff
changeset
 | 
124  | 
return (grfcurr_id >= lengthof(TTDPatch_To_OTTDIndex)) ? grfcurr_id : TTDPatch_To_OTTDIndex[grfcurr_id];  | 
| 
4625
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
125  | 
}  | 
| 
 
3e45c59b5d64
(svn r6485) -NewGRF Feature: Match the order of TTDPatch's currencies with those used in OTTD.
 
belugas 
parents: 
4602 
diff
changeset
 | 
126  | 
|
| 
6449
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
127  | 
/**  | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
128  | 
* get a mask of the allowed currencies depending on the year  | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
129  | 
* @return mask of currencies  | 
| 
 
e520244dc71e
(svn r8859) -Cleanup: doxygen changes.  Mostly @files missing tags and a few comments style.
 
belugas 
parents: 
5835 
diff
changeset
 | 
130  | 
*/  | 
| 6573 | 131  | 
uint GetMaskOfAllowedCurrencies()  | 
| 
2291
 
2b064aa97f91
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
 
tron 
parents: 
2186 
diff
changeset
 | 
132  | 
{
 | 
| 
 
2b064aa97f91
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
 
tron 
parents: 
2186 
diff
changeset
 | 
133  | 
uint mask = 0;  | 
| 
 
2b064aa97f91
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
 
tron 
parents: 
2186 
diff
changeset
 | 
134  | 
uint i;  | 
| 
 
2b064aa97f91
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
 
tron 
parents: 
2186 
diff
changeset
 | 
135  | 
|
| 
4377
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
136  | 
	for (i = 0; i < NUM_CURRENCY; i++) {
 | 
| 
4297
 
47ce9665b4af
(svn r5934) -Cleanup: forgot some conversions to Year and to Date
 
rubidium 
parents: 
4293 
diff
changeset
 | 
137  | 
Year to_euro = _currency_specs[i].to_euro;  | 
| 
2291
 
2b064aa97f91
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
 
tron 
parents: 
2186 
diff
changeset
 | 
138  | 
|
| 
4293
 
2c24234a7aec
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
 
rubidium 
parents: 
4286 
diff
changeset
 | 
139  | 
if (to_euro != CF_NOEURO && to_euro != CF_ISEURO && _cur_year >= to_euro) continue;  | 
| 
 
2c24234a7aec
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
 
rubidium 
parents: 
4286 
diff
changeset
 | 
140  | 
if (to_euro == CF_ISEURO && _cur_year < 2000) continue;  | 
| 
2291
 
2b064aa97f91
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
 
tron 
parents: 
2186 
diff
changeset
 | 
141  | 
mask |= (1 << i);  | 
| 
 
2b064aa97f91
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
 
tron 
parents: 
2186 
diff
changeset
 | 
142  | 
}  | 
| 
3596
 
443a7377c67e
(svn r4487) - Codechange: replace the custom currency magic number 23 with a define
 
peter1138 
parents: 
2495 
diff
changeset
 | 
143  | 
mask |= (1 << CUSTOM_CURRENCY_ID); // always allow custom currency  | 
| 
2291
 
2b064aa97f91
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
 
tron 
parents: 
2186 
diff
changeset
 | 
144  | 
return mask;  | 
| 
 
2b064aa97f91
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
 
tron 
parents: 
2186 
diff
changeset
 | 
145  | 
}  | 
| 
 
2b064aa97f91
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
 
tron 
parents: 
2186 
diff
changeset
 | 
146  | 
|
| 
4377
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
147  | 
/**  | 
| 
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
148  | 
* Verify if the currency chosen by the user is about to be converted to Euro  | 
| 
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
149  | 
**/  | 
| 6573 | 150  | 
void CheckSwitchToEuro()  | 
| 
2306
 
3d4efe849dd9
(svn r2830) Move CheckSwitchToEuro() to currency.[ch] and hide the truth about the custom currency behind a #define
 
tron 
parents: 
2291 
diff
changeset
 | 
151  | 
{
 | 
| 
 
3d4efe849dd9
(svn r2830) Move CheckSwitchToEuro() to currency.[ch] and hide the truth about the custom currency behind a #define
 
tron 
parents: 
2291 
diff
changeset
 | 
152  | 
if (_currency_specs[_opt.currency].to_euro != CF_NOEURO &&  | 
| 
 
3d4efe849dd9
(svn r2830) Move CheckSwitchToEuro() to currency.[ch] and hide the truth about the custom currency behind a #define
 
tron 
parents: 
2291 
diff
changeset
 | 
153  | 
_currency_specs[_opt.currency].to_euro != CF_ISEURO &&  | 
| 
4293
 
2c24234a7aec
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
 
rubidium 
parents: 
4286 
diff
changeset
 | 
154  | 
			_cur_year >= _currency_specs[_opt.currency].to_euro) {
 | 
| 
2306
 
3d4efe849dd9
(svn r2830) Move CheckSwitchToEuro() to currency.[ch] and hide the truth about the custom currency behind a #define
 
tron 
parents: 
2291 
diff
changeset
 | 
155  | 
_opt.currency = 2; // this is the index of euro above.  | 
| 
 
3d4efe849dd9
(svn r2830) Move CheckSwitchToEuro() to currency.[ch] and hide the truth about the custom currency behind a #define
 
tron 
parents: 
2291 
diff
changeset
 | 
156  | 
AddNewsItem(STR_EURO_INTRODUCE, NEWS_FLAGS(NM_NORMAL, 0, NT_ECONOMY, 0), 0, 0);  | 
| 
 
3d4efe849dd9
(svn r2830) Move CheckSwitchToEuro() to currency.[ch] and hide the truth about the custom currency behind a #define
 
tron 
parents: 
2291 
diff
changeset
 | 
157  | 
}  | 
| 
 
3d4efe849dd9
(svn r2830) Move CheckSwitchToEuro() to currency.[ch] and hide the truth about the custom currency behind a #define
 
tron 
parents: 
2291 
diff
changeset
 | 
158  | 
}  | 
| 
4138
 
15f4aa024ad4
(svn r5496) -CodeChange: Removed two compiler warnings
 
belugas 
parents: 
3596 
diff
changeset
 | 
159  | 
|
| 
4377
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
160  | 
/**  | 
| 
6705
 
d3fb7785c0a4
(svn r9467) -Fix(FS#703,6108): When resetting the array of currencies, the custom currency was reset too, thus loosing the setting a user could have used for it.(glx)
 
belugas 
parents: 
6573 
diff
changeset
 | 
161  | 
* Will fill _currency_specs array with  | 
| 
4377
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
162  | 
* default values from origin_currency_specs  | 
| 
6705
 
d3fb7785c0a4
(svn r9467) -Fix(FS#703,6108): When resetting the array of currencies, the custom currency was reset too, thus loosing the setting a user could have used for it.(glx)
 
belugas 
parents: 
6573 
diff
changeset
 | 
163  | 
* Called only from newgrf.cpp and settings.cpp.  | 
| 
 
d3fb7785c0a4
(svn r9467) -Fix(FS#703,6108): When resetting the array of currencies, the custom currency was reset too, thus loosing the setting a user could have used for it.(glx)
 
belugas 
parents: 
6573 
diff
changeset
 | 
164  | 
* @param preserve_custom will not reset custom currency (the latest one on the list)  | 
| 
 
d3fb7785c0a4
(svn r9467) -Fix(FS#703,6108): When resetting the array of currencies, the custom currency was reset too, thus loosing the setting a user could have used for it.(glx)
 
belugas 
parents: 
6573 
diff
changeset
 | 
165  | 
* if ever it is flagged to true. In which case, the total size of the memory to move  | 
| 
 
d3fb7785c0a4
(svn r9467) -Fix(FS#703,6108): When resetting the array of currencies, the custom currency was reset too, thus loosing the setting a user could have used for it.(glx)
 
belugas 
parents: 
6573 
diff
changeset
 | 
166  | 
* will be one currency spec less, thus preserving the custom curreny from been  | 
| 
 
d3fb7785c0a4
(svn r9467) -Fix(FS#703,6108): When resetting the array of currencies, the custom currency was reset too, thus loosing the setting a user could have used for it.(glx)
 
belugas 
parents: 
6573 
diff
changeset
 | 
167  | 
* overwritten.  | 
| 
4377
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
168  | 
**/  | 
| 
6705
 
d3fb7785c0a4
(svn r9467) -Fix(FS#703,6108): When resetting the array of currencies, the custom currency was reset too, thus loosing the setting a user could have used for it.(glx)
 
belugas 
parents: 
6573 
diff
changeset
 | 
169  | 
void ResetCurrencies(bool preserve_custom)  | 
| 
4377
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
170  | 
{
 | 
| 
6705
 
d3fb7785c0a4
(svn r9467) -Fix(FS#703,6108): When resetting the array of currencies, the custom currency was reset too, thus loosing the setting a user could have used for it.(glx)
 
belugas 
parents: 
6573 
diff
changeset
 | 
171  | 
memcpy(&_currency_specs, &origin_currency_specs, sizeof(origin_currency_specs) - (preserve_custom ? sizeof(_custom_currency) : 0));  | 
| 
4377
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
172  | 
}  | 
| 
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
173  | 
|
| 
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
174  | 
/**  | 
| 
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
175  | 
* Build a list of currency names StringIDs to use in a dropdown list  | 
| 
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
176  | 
* @return Pointer to a (static) array of StringIDs  | 
| 
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
177  | 
*/  | 
| 6573 | 178  | 
StringID* BuildCurrencyDropdown()  | 
| 
4377
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
179  | 
{
 | 
| 
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
180  | 
/* Allow room for all currencies, plus a terminator entry */  | 
| 
6552
 
c41f3d3bfe18
(svn r9027) -Fix [FS#664]: desync caused by buffer overrun.
 
rubidium 
parents: 
6449 
diff
changeset
 | 
181  | 
static StringID names[NUM_CURRENCY + 1];  | 
| 
4377
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
182  | 
uint i;  | 
| 
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
183  | 
|
| 
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
184  | 
/* Add each name */  | 
| 
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
185  | 
	for (i = 0; i < NUM_CURRENCY; i++) {
 | 
| 
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
186  | 
names[i] = _currency_specs[i].name;  | 
| 
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
187  | 
}  | 
| 
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
188  | 
/* Terminate the list */  | 
| 
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
189  | 
names[i] = INVALID_STRING_ID;  | 
| 
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
190  | 
|
| 
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
191  | 
return names;  | 
| 
 
0fb9077b8173
(svn r6108) -NewGRF Feature: Implement currencies replacment via grf file.
 
belugas 
parents: 
4311 
diff
changeset
 | 
192  | 
}  |