(svn r1222) Currency cleanup. Changed some currency symbols according to forum suggestions (thx ChrisCF) and rearranged the currencies alphabetically (except for the major ones).
authordominik
Wed, 22 Dec 2004 16:54:55 +0000
changeset 762 ef014856bd88
parent 761 9bfb58cb3a69
child 763 ced9fcae239d
(svn r1222) Currency cleanup. Changed some currency symbols according to forum suggestions (thx ChrisCF) and rearranged the currencies alphabetically (except for the major ones).
economy.c
lang/english.txt
saveload.c
strings.c
table/currency.h
ttd.c
--- a/economy.c	Wed Dec 22 15:45:41 2004 +0000
+++ b/economy.c	Wed Dec 22 16:54:55 2004 +0000
@@ -18,6 +18,31 @@
 #include "engine.h"
 #include "network_data.h"
 
+// get a mask of the allowed currencies depending on the year
+uint GetMaskOfAllowedCurrencies()
+{
+	int i;
+	uint mask = 0;
+	for(i=0; i!=lengthof(_currency_specs); i++) {
+		uint16 to_euro = _currency_specs[i].to_euro;
+		if (i == 23) mask |= (1 << 23); // always allow custom currency
+		if (to_euro != CF_NOEURO && to_euro != CF_ISEURO && _cur_year >= (to_euro-1920)) continue;
+		if (_cur_year < (2000-1920) && (to_euro == CF_ISEURO)) continue;
+		mask |= (1 << i);
+	}
+	return mask;
+}
+
+void CheckSwitchToEuro()
+{
+	if (_currency_specs[_opt.currency].to_euro != CF_NOEURO &&
+			_currency_specs[_opt.currency].to_euro != CF_ISEURO &&
+			_cur_year >= (_currency_specs[_opt.currency].to_euro-1920)) {
+		_opt.currency = 2; // this is the index of euro above.
+		AddNewsItem(STR_EURO_INTRODUCE, NEWS_FLAGS(NM_NORMAL,0,NT_ECONOMY,0), 0, 0);
+	}
+}
+
 void UpdatePlayerHouse(Player *p, uint score)
 {
 	byte val;
--- a/lang/english.txt	Wed Dec 22 15:45:41 2004 +0000
+++ b/lang/english.txt	Wed Dec 22 16:54:55 2004 +0000
@@ -868,30 +868,31 @@
 STR_TOWNNAME_CZECH						:Czech
 ############ end of	townname region
 
-STR_CURR_POUNDS							:Pounds ({POUNDSIGN})
-STR_CURR_DOLLARS						:Dollars ($)
-STR_CURR_FF							:Franc (FF)
-STR_CURR_DM							:Deutschmark (DM)
-STR_CURR_YEN							:Yen ({YENSIGN})
-STR_CURR_PT							:Peseta (Pt)
-STR_CURR_FT							:Hungarian Forint (Ft)
-STR_CURR_ZL							:Polish Zloty (zl)
-STR_CURR_ATS							:Austrian Shilling (ATS)
-STR_CURR_BEF							:Belgian Franc (BEF)
-STR_CURR_DKK							:Danish Krone (DKK)
-STR_CURR_FIM							:Finnish Markka (FIM)
-STR_CURR_GRD							:Greek Drachma (GRD)
-STR_CURR_CHF							:Swiss Franc (CHF)
-STR_CURR_NLG							:Dutch Guilder (NLG)
-STR_CURR_ITL							:Italian Lira (ITL)
-STR_CURR_CUSTOM						:Custom...
-STR_CURR_SEK							:Swedish Krona (SEK)
-STR_CURR_RUR							:Russian Rubel (rur)
-STR_CURR_CZK							:Czech Koruna (CZK)
-STR_CURR_ISK							:Icelandic Krona (ISK)
-STR_CURR_NOK							:Norwegian Krone (NOK)
-STR_CURR_ROL							:Romanian Leu (Lei)
-STR_CURR_EUR							:Euro (¤)
+STR_CURR_GBP				:Pounds ({POUNDSIGN})
+STR_CURR_USD				:Dollars ($)
+STR_CURR_EUR				:Euro (¤)
+STR_CURR_YEN				:Yen ({YENSIGN})
+STR_CURR_ATS				:Austrian Shilling (ATS)
+STR_CURR_BEF				:Belgian Franc (BEF)
+STR_CURR_CHF				:Swiss Franc (CHF)
+STR_CURR_CZK				:Czech Koruna (CZK)
+STR_CURR_DEM				:Deutschmark (DEM)
+STR_CURR_DKK				:Danish Krone (DKK)
+STR_CURR_ESP				:Peseta (ESP)
+STR_CURR_FIM				:Finnish Markka (FIM)
+STR_CURR_FRF				:Franc (FRF)
+STR_CURR_GRD				:Greek Drachma (GRD)
+STR_CURR_HUF				:Hungarian Forint (HUF)
+STR_CURR_ISK				:Icelandic Krona (ISK)
+STR_CURR_ITL				:Italian Lira (ITL)
+STR_CURR_NLG				:Dutch Guilder (NLG)
+STR_CURR_NOK				:Norwegian Krone (NOK)
+STR_CURR_PLN				:Polish Zloty (PLN)
+STR_CURR_ROL				:Romanian Leu (ROL)
+STR_CURR_RUR				:Russian Rubles (RUR)
+STR_CURR_SEK				:Swedish Krona (SEK)
+
+STR_CURR_CUSTOM			:Custom...
 
 STR_OPTIONS_LANG						:{BLACK}Language
 STR_OPTIONS_LANG_CBO						:{BLACK}{SKIP}{SKIP}{SKIP}{SKIP}{SKIP}{SKIP}{STRING}
--- a/saveload.c	Wed Dec 22 15:45:41 2004 +0000
+++ b/saveload.c	Wed Dec 22 16:54:55 2004 +0000
@@ -9,7 +9,7 @@
 
 enum {
 	SAVEGAME_MAJOR_VERSION = 4,
-	SAVEGAME_MINOR_VERSION = 1,
+	SAVEGAME_MINOR_VERSION = 2,
 
 	SAVEGAME_LOADABLE_VERSION = (SAVEGAME_MAJOR_VERSION << 8) + SAVEGAME_MINOR_VERSION
 };
--- a/strings.c	Wed Dec 22 15:45:41 2004 +0000
+++ b/strings.c	Wed Dec 22 16:54:55 2004 +0000
@@ -33,29 +33,29 @@
 } LanguagePackHeader;
 
 const uint16 _currency_string_list[] = {
-	STR_CURR_POUNDS,
-	STR_CURR_DOLLARS,
-	STR_CURR_FF,
-	STR_CURR_DM,
+	STR_CURR_GBP,
+	STR_CURR_USD,
+	STR_CURR_EUR,
 	STR_CURR_YEN,
-	STR_CURR_PT,
-	STR_CURR_FT,
-	STR_CURR_ZL,
 	STR_CURR_ATS,
 	STR_CURR_BEF,
+	STR_CURR_CHF,
+	STR_CURR_CZK,
+	STR_CURR_DEM,
 	STR_CURR_DKK,
+	STR_CURR_ESP,
 	STR_CURR_FIM,
+	STR_CURR_FRF,
 	STR_CURR_GRD,
-	STR_CURR_CHF,
-	STR_CURR_NLG,
+	STR_CURR_HUF,
+	STR_CURR_ISK,
 	STR_CURR_ITL,
-	STR_CURR_SEK,
+	STR_CURR_NLG,
+	STR_CURR_NOK,
+	STR_CURR_PLN,
+	STR_CURR_ROL,
 	STR_CURR_RUR,
-	STR_CURR_CZK,
-	STR_CURR_ISK,
-	STR_CURR_NOK,
-	STR_CURR_EUR,
-	STR_CURR_ROL,
+	STR_CURR_SEK,
 	STR_CURR_CUSTOM,
 	INVALID_STRING_ID
 };
@@ -67,31 +67,6 @@
 	/* LT_CANDY */  {STR_PASSENGERS, STR_TONS, STR_BAGS, STR_NOTHING, STR_NOTHING, STR_TONS, STR_TONS, STR_LITERS, STR_TONS, STR_NOTHING, STR_LITERS, STR_NOTHING}
 };
 
-// get a mask of the allowed currencies depending on the year
-uint GetMaskOfAllowedCurrencies()
-{
-	int i;
-	uint mask = 0;
-	for(i=0; i!=lengthof(_currency_specs); i++) {
-		uint16 to_euro = _currency_specs[i].to_euro;
-		if (i == 23) mask |= (1 << 23); // always allow custom currency
-		if (to_euro != CF_NOEURO && to_euro != CF_ISEURO && _cur_year >= (to_euro-1920)) continue;
-		if (_cur_year < (2000-1920) && (to_euro == CF_ISEURO)) continue;
-		mask |= (1 << i);
-	}
-	return mask;
-}
-
-void CheckSwitchToEuro()
-{
-	if (_currency_specs[_opt.currency].to_euro != CF_NOEURO &&
-			_currency_specs[_opt.currency].to_euro != CF_ISEURO &&
-			_cur_year >= (_currency_specs[_opt.currency].to_euro-1920)) {
-		_opt.currency = 21; // this is the index of euro above.
-		AddNewsItem(STR_EURO_INTRODUCE, NEWS_FLAGS(NM_NORMAL,0,NT_ECONOMY,0), 0, 0);
-	}
-}
-
 static byte *str_cat(byte *dst, const byte *src)
 {
 	while ( (*dst++ = *src++) != 0) {}
--- a/table/currency.h	Wed Dec 22 15:45:41 2004 +0000
+++ b/table/currency.h	Wed Dec 22 16:54:55 2004 +0000
@@ -1,26 +1,30 @@
-
+// exchange rate    prefix
+// |  separator        |     postfix
+// |   |    Euro year  |       |
+// |   |    |          |       |
 CurrencySpec _currency_specs[] = {
-{ 1,   ',', CF_NOEURO,              "\xA3", "" },     // british pounds
-{ 2,   ',', CF_NOEURO,              "$",    "" },     // us dollars
-{ 10,  '.', 2002, "FF ",  "" },     // french francs
-{ 4,   '.', 2002, "DM ",  "" },     // deutsche mark
-{ 200, ',', CF_NOEURO,              "\xA5", "" },     // yen
-{ 200, '.', 2002, "Pt",   "" },     // spanish pesetas
-{ 376, ',', 2002, "",     " Ft" },
-{ 6,   ' ', CF_NOEURO,              "",     " zl" },
-{ 19,  ',', 2002, "ATS ", "" },
-{ 57,  ',', 2002, "BEF ", "" },
-{ 10,  '.', CF_NOEURO,              "",     " kr" },
-{ 8,   ',', 2002, "FIM ", "" },
-{ 480, ',', 2002, "GRD ", "" },
-{ 2,   ',', CF_NOEURO,              "CHF ", "" },
-{ 3,   ',', 2002, "NLG ", "" },
-{ 2730,',', 2002, "ITL ", "" },
-{ 13,  '.', CF_NOEURO,              "",     " kr" },
-{ 5,   ' ', CF_NOEURO,              "",     " rur" },
-{ 50,  ',', CF_NOEURO,              "",     " Kc" },
-{ 130, '.', CF_NOEURO,              "",     " kr" },
-{ 11,  '.', CF_NOEURO,              "",     " kr" },
-{ 2,   ',', CF_ISEURO,      "¤",    "" },
-{ 6,   '.', CF_NOEURO,              "",     " Lei" },
+{ 1,   ',', CF_NOEURO, "\xA3",   "" }, // british pounds
+{ 2,   ',', CF_NOEURO, "$",      "" }, // us dollars
+{ 2,   ',', CF_ISEURO, "¤",      "" }, // Euro
+{ 200, ',', CF_NOEURO, "\xA5",   "" }, // yen
+{ 57,  ',', 2002,     "BEF ",    "" }, // belgian franc
+{ 2,   ',', CF_NOEURO,"CHF ",    "" }, // swiss franc
+{ 480, ',', 2002,         "", "Dr." }, // greek drachma
+{ 4,   '.', 2002,      "DM ",    "" }, // deutsche mark
+{ 10,  '.', 2002,      "FF ",    "" }, // french francs
+{ 376, ',', 2002,         "", " Ft" }, // forint
+{ 50,  ',', CF_NOEURO,    "", " Kc" }, // czech koruna // TODO: Should use the "c" with an upside down "^"
+{ 13,  '.', CF_NOEURO,    "", " Kr" }, // swedish krona
+{ 130, '.', CF_NOEURO,    "", " Kr" }, // icelandic krona
+{ 11,  '.', CF_NOEURO,    "", " Kr" }, // norwegian krone
+{ 10,  '.', CF_NOEURO,    "", " kr" }, // danish krone
+{ 2730,',', 2002,         "", " L." }, // italian lira
+{ 6,   '.', CF_NOEURO,    ""," Lei" }, // romanian Lei
+{ 8,   ',', 2002,         "", " MK" }, // finnish markka
+{ 3,   ',', 2002,     "NLG ",    "" }, // dutch gulden
+{ 5,   ' ', CF_NOEURO,    "",  " p" }, // russian rouble
+{ 200, '.', 2002,     "Pts ",    "" }, // spanish pesetas
+{ 19,  ',', 2002,         "", " S." }, // austrian schilling
+{ 6,   ' ', CF_NOEURO,    "", " zl" }, // polish zloty
+{ 1,   ' ', CF_NOEURO,    "",    "" }, // custom currency
 };
--- a/ttd.c	Wed Dec 22 15:45:41 2004 +0000
+++ b/ttd.c	Wed Dec 22 16:54:55 2004 +0000
@@ -1185,6 +1185,19 @@
 	*/
 }
 
+byte covert_currency[] = {
+	 0,  1, 12,  8,  3,
+	10, 14, 19,  4,  5,
+	 9, 11, 13,  6, 17,
+	16, 22, 21,  7, 15,
+	18,  2, 20, };
+
+// since savegame version 4.2 the currencies are arranged differently
+void UpdateCurrencies()
+{
+	_opt.currency = covert_currency[_opt.currency];
+}
+
 extern void UpdateOldAircraft();
 
 bool AfterLoadGame(uint version)
@@ -1202,6 +1215,11 @@
 		UpdateExclusiveRights();
 	}
 
+	// from version 4.2 of the savegame, currencies are in a different order
+	if (version <= 0x401) {
+		UpdateCurrencies();
+	}
+
 	// convert road side to my format.
 	if (_opt.road_side) _opt.road_side = 1;