summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-05-20 15:36:44 +0000
committerrubidium <rubidium@openttd.org>2010-05-20 15:36:44 +0000
commit9d29c54b03ab1b8c3860885fa2ec2706c1dcf6fa (patch)
treed9d4213caa1664327b18cc073ea2c429f850cdeb
parent8d4bb2285cec39c62d6e62b8d6bcd9c0b6cd786d (diff)
downloadopenttd-9d29c54b03ab1b8c3860885fa2ec2706c1dcf6fa.tar.xz
(svn r19867) -Change: use non-breaking spaces for currency pre-/postfixes.
-rw-r--r--src/currency.cpp67
-rw-r--r--src/strgen/strgen.cpp6
-rw-r--r--src/string_type.h3
3 files changed, 40 insertions, 36 deletions
diff --git a/src/currency.cpp b/src/currency.cpp
index 535179f88..8cd02b3dc 100644
--- a/src/currency.cpp
+++ b/src/currency.cpp
@@ -14,43 +14,44 @@
#include "news_func.h"
#include "settings_type.h"
#include "date_func.h"
+#include "string_type.h"
#include "table/strings.h"
- /* exchange rate prefix symbol_pos
- * | separator | postfix |
- * | | Euro year | | | name
- * | | | | | | | */
+ /* exchange rate prefix symbol_pos
+ * | separator | postfix |
+ * | | Euro year | | | name
+ * | | | | | | | */
static const CurrencySpec origin_currency_specs[NUM_CURRENCY] = {
- { 1, "", CF_NOEURO, "\xC2\xA3", "", 0, STR_GAME_OPTIONS_CURRENCY_GBP }, ///< british pounds
- { 2, "", CF_NOEURO, "$", "", 0, STR_GAME_OPTIONS_CURRENCY_USD }, ///< us dollars
- { 2, "", CF_ISEURO, "\xE2\x82\xAC", "", 0, STR_GAME_OPTIONS_CURRENCY_EUR }, ///< Euro
- { 220, "", CF_NOEURO, "\xC2\xA5", "", 0, STR_GAME_OPTIONS_CURRENCY_YEN }, ///< yen
- { 20, "", 2002, "", " S.", 1, STR_GAME_OPTIONS_CURRENCY_ATS }, ///< austrian schilling
- { 59, "", 2002, "BEF ", "", 0, STR_GAME_OPTIONS_CURRENCY_BEF }, ///< belgian franc
- { 2, "", CF_NOEURO, "CHF ", "", 0, STR_GAME_OPTIONS_CURRENCY_CHF }, ///< swiss franc
- { 41, "", CF_NOEURO, "", " K\xC4\x8D", 1, STR_GAME_OPTIONS_CURRENCY_CZK }, ///< czech koruna
- { 3, "", 2002, "DM ", "", 0, STR_GAME_OPTIONS_CURRENCY_DEM }, ///< deutsche mark
- { 11, "", CF_NOEURO, "", " kr", 1, STR_GAME_OPTIONS_CURRENCY_DKK }, ///< danish krone
- { 245, "", 2002, "Pts ", "", 0, STR_GAME_OPTIONS_CURRENCY_ESP }, ///< spanish pesetas
- { 9, "", 2002, "", " mk", 1, STR_GAME_OPTIONS_CURRENCY_FIM }, ///< finnish markka
- { 10, "", 2002, "FF ", "", 0, STR_GAME_OPTIONS_CURRENCY_FRF }, ///< french francs
- { 500, "", 2002, "", "Dr.", 1, STR_GAME_OPTIONS_CURRENCY_GRD }, ///< greek drachma
- { 378, "", CF_NOEURO, "", " Ft", 1, STR_GAME_OPTIONS_CURRENCY_HUF }, ///< hungarian forint
- { 130, "", CF_NOEURO, "", " Kr", 1, STR_GAME_OPTIONS_CURRENCY_ISK }, ///< icelandic krona
- { 2850, "", 2002, "", " L.", 1, STR_GAME_OPTIONS_CURRENCY_ITL }, ///< italian lira
- { 3, "", 2002, "NLG ", "", 0, STR_GAME_OPTIONS_CURRENCY_NLG }, ///< dutch gulden
- { 12, "", CF_NOEURO, "", " Kr", 1, STR_GAME_OPTIONS_CURRENCY_NOK }, ///< norwegian krone
- { 6, "", CF_NOEURO, "", " z\xC5\x82", 1, STR_GAME_OPTIONS_CURRENCY_PLN }, ///< polish zloty
- { 5, "", CF_NOEURO, "", " Lei", 1, STR_GAME_OPTIONS_CURRENCY_RON }, ///< romanian Lei
- { 50, "", CF_NOEURO, "", " p", 1, STR_GAME_OPTIONS_CURRENCY_RUR }, ///< russian rouble
- { 352, "", 2007, "", " SIT", 1, STR_GAME_OPTIONS_CURRENCY_SIT }, ///< slovenian tolar
- { 13, "", CF_NOEURO, "", " Kr", 1, STR_GAME_OPTIONS_CURRENCY_SEK }, ///< swedish krona
- { 3, "", CF_NOEURO, "", " TL", 1, STR_GAME_OPTIONS_CURRENCY_TRY }, ///< turkish lira
- { 52, "", 2009, "", " Sk", 1, STR_GAME_OPTIONS_CURRENCY_SKK }, ///< slovak koruna
- { 4, "", CF_NOEURO, "R$ ", "", 0, STR_GAME_OPTIONS_CURRENCY_BRL }, ///< brazil real
- { 20, "", CF_NOEURO, "", " EEK", 1, STR_GAME_OPTIONS_CURRENCY_EEK }, ///< estonian krooni
- { 1, "", CF_NOEURO, "", "", 2, STR_GAME_OPTIONS_CURRENCY_CUSTOM }, ///< custom currency
+ { 1, "", CF_NOEURO, "\xC2\xA3", "", 0, STR_GAME_OPTIONS_CURRENCY_GBP }, ///< british pounds
+ { 2, "", CF_NOEURO, "$", "", 0, STR_GAME_OPTIONS_CURRENCY_USD }, ///< us dollars
+ { 2, "", CF_ISEURO, "\xE2\x82\xAC", "", 0, STR_GAME_OPTIONS_CURRENCY_EUR }, ///< Euro
+ { 220, "", CF_NOEURO, "\xC2\xA5", "", 0, STR_GAME_OPTIONS_CURRENCY_YEN }, ///< yen
+ { 20, "", 2002, "", NBSP"S.", 1, STR_GAME_OPTIONS_CURRENCY_ATS }, ///< austrian schilling
+ { 59, "", 2002, "BEF"NBSP, "", 0, STR_GAME_OPTIONS_CURRENCY_BEF }, ///< belgian franc
+ { 2, "", CF_NOEURO, "CHF"NBSP, "", 0, STR_GAME_OPTIONS_CURRENCY_CHF }, ///< swiss franc
+ { 41, "", CF_NOEURO, "", NBSP"K\xC4\x8D", 1, STR_GAME_OPTIONS_CURRENCY_CZK }, ///< czech koruna
+ { 3, "", 2002, "DM"NBSP, "", 0, STR_GAME_OPTIONS_CURRENCY_DEM }, ///< deutsche mark
+ { 11, "", CF_NOEURO, "", NBSP"kr", 1, STR_GAME_OPTIONS_CURRENCY_DKK }, ///< danish krone
+ { 245, "", 2002, "Pts"NBSP, "", 0, STR_GAME_OPTIONS_CURRENCY_ESP }, ///< spanish pesetas
+ { 9, "", 2002, "", NBSP"mk", 1, STR_GAME_OPTIONS_CURRENCY_FIM }, ///< finnish markka
+ { 10, "", 2002, "FF"NBSP, "", 0, STR_GAME_OPTIONS_CURRENCY_FRF }, ///< french francs
+ { 500, "", 2002, "", "Dr.", 1, STR_GAME_OPTIONS_CURRENCY_GRD }, ///< greek drachma
+ { 378, "", CF_NOEURO, "", NBSP"Ft", 1, STR_GAME_OPTIONS_CURRENCY_HUF }, ///< hungarian forint
+ { 130, "", CF_NOEURO, "", NBSP"Kr", 1, STR_GAME_OPTIONS_CURRENCY_ISK }, ///< icelandic krona
+ { 2850, "", 2002, "", NBSP"L.", 1, STR_GAME_OPTIONS_CURRENCY_ITL }, ///< italian lira
+ { 3, "", 2002, "NLG"NBSP, "", 0, STR_GAME_OPTIONS_CURRENCY_NLG }, ///< dutch gulden
+ { 12, "", CF_NOEURO, "", NBSP"Kr", 1, STR_GAME_OPTIONS_CURRENCY_NOK }, ///< norwegian krone
+ { 6, "", CF_NOEURO, "", NBSP"z\xC5\x82", 1, STR_GAME_OPTIONS_CURRENCY_PLN }, ///< polish zloty
+ { 5, "", CF_NOEURO, "", NBSP"Lei", 1, STR_GAME_OPTIONS_CURRENCY_RON }, ///< romanian Lei
+ { 50, "", CF_NOEURO, "", NBSP"p", 1, STR_GAME_OPTIONS_CURRENCY_RUR }, ///< russian rouble
+ { 352, "", 2007, "", NBSP"SIT", 1, STR_GAME_OPTIONS_CURRENCY_SIT }, ///< slovenian tolar
+ { 13, "", CF_NOEURO, "", NBSP"Kr", 1, STR_GAME_OPTIONS_CURRENCY_SEK }, ///< swedish krona
+ { 3, "", CF_NOEURO, "", NBSP"TL", 1, STR_GAME_OPTIONS_CURRENCY_TRY }, ///< turkish lira
+ { 52, "", 2009, "", NBSP"Sk", 1, STR_GAME_OPTIONS_CURRENCY_SKK }, ///< slovak koruna
+ { 4, "", CF_NOEURO, "R$"NBSP, "", 0, STR_GAME_OPTIONS_CURRENCY_BRL }, ///< brazil real
+ { 20, "", CF_NOEURO, "", NBSP"EEK", 1, STR_GAME_OPTIONS_CURRENCY_EEK }, ///< estonian krooni
+ { 1, "", CF_NOEURO, "", "", 2, STR_GAME_OPTIONS_CURRENCY_CUSTOM }, ///< custom currency
};
/* Array of currencies used by the system */
diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp
index bfcc8c8a8..d71f545a8 100644
--- a/src/strgen/strgen.cpp
+++ b/src/strgen/strgen.cpp
@@ -536,13 +536,13 @@ static void HandlePragma(char *str)
}
} else if (!memcmp(str, "digitsep ", 9)) {
str += 9;
- strecpy(_lang_digit_group_separator, strcmp(str, "{NBSP}") == 0 ? "\xC2\xA0" : str, lastof(_lang_digit_group_separator));
+ strecpy(_lang_digit_group_separator, strcmp(str, "{NBSP}") == 0 ? NBSP : str, lastof(_lang_digit_group_separator));
} else if (!memcmp(str, "digitsepcur ", 12)) {
str += 12;
- strecpy(_lang_digit_group_separator_currency, strcmp(str, "{NBSP}") == 0 ? "\xC2\xA0" : str, lastof(_lang_digit_group_separator_currency));
+ strecpy(_lang_digit_group_separator_currency, strcmp(str, "{NBSP}") == 0 ? NBSP : str, lastof(_lang_digit_group_separator_currency));
} else if (!memcmp(str, "decimalsep ", 11)) {
str += 11;
- strecpy(_lang_digit_decimal_separator, strcmp(str, "{NBSP}") == 0 ? "\xC2\xA0" : str, lastof(_lang_digit_decimal_separator));
+ strecpy(_lang_digit_decimal_separator, strcmp(str, "{NBSP}") == 0 ? NBSP : str, lastof(_lang_digit_decimal_separator));
} else if (!memcmp(str, "winlangid ", 10)) {
const char *buf = str + 10;
long langid = strtol(buf, NULL, 16);
diff --git a/src/string_type.h b/src/string_type.h
index 2fb8d8f57..7fb8e0137 100644
--- a/src/string_type.h
+++ b/src/string_type.h
@@ -12,6 +12,9 @@
#ifndef STRING_TYPE_H
#define STRING_TYPE_H
+/** A non-breaking space. */
+#define NBSP "\xC2\xA0"
+
/**
* Valid filter types for IsValidChar.
*/