From 498ca56f57a24db03aac46dc124c2d3641506372 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sun, 21 Jan 2018 16:26:19 +0100 Subject: [PATCH] Fix unicode values of some characters --- src/openrct2/drawing/Font.cpp | 4 ++-- src/openrct2/localisation/ConversionTables.cpp | 2 +- src/openrct2/localisation/ConversionTables.h | 2 +- src/openrct2/localisation/Convert.cpp | 2 +- src/openrct2/localisation/FormatCodes.h | 9 +++++---- src/openrct2/localisation/Localisation.h | 3 ++- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/openrct2/drawing/Font.cpp b/src/openrct2/drawing/Font.cpp index 9e22c021b0..9aebdd34cf 100644 --- a/src/openrct2/drawing/Font.cpp +++ b/src/openrct2/drawing/Font.cpp @@ -66,7 +66,7 @@ sint32 font_sprite_get_codepoint_offset(sint32 codepoint) case FORMAT_ENDQUOTES: return 34 - 32; case FORMAT_UP: return 160 - 32; - case FORMAT_SYMBOL_i: return 160 - 32; + case FORMAT_INVERTEDEXCLAMATION: return 160 - 32; case FORMAT_POUND: return 163 - 32; case FORMAT_YEN: return 165 - 32; @@ -187,7 +187,7 @@ bool font_supports_string_sprite(const utf8 *text) switch (codepoint) { case FORMAT_ENDQUOTES: case FORMAT_UP: - case FORMAT_SYMBOL_i: + case FORMAT_INVERTEDEXCLAMATION: case FORMAT_POUND: case FORMAT_YEN: case FORMAT_COPYRIGHT: diff --git a/src/openrct2/localisation/ConversionTables.cpp b/src/openrct2/localisation/ConversionTables.cpp index 4aaae22a20..bae693878e 100644 --- a/src/openrct2/localisation/ConversionTables.cpp +++ b/src/openrct2/localisation/ConversionTables.cpp @@ -181,7 +181,7 @@ const encoding_convert_entry RCT2ToUnicodeTable[256] = { 158, 158 }, { RCT2_A_OGONEK_UC, UNICODE_A_OGONEK_UC }, { 160, FORMAT_UP }, - { 161, FORMAT_SYMBOL_i }, + { 161, FORMAT_INVERTEDEXCLAMATION }, { RCT2_C_ACUTE_UC, UNICODE_C_ACUTE_UC }, { 163, FORMAT_POUND }, { 164, 164 }, diff --git a/src/openrct2/localisation/ConversionTables.h b/src/openrct2/localisation/ConversionTables.h index 688a47b10a..af682ab590 100644 --- a/src/openrct2/localisation/ConversionTables.h +++ b/src/openrct2/localisation/ConversionTables.h @@ -21,7 +21,7 @@ typedef struct encoding_convert_entry { uint16 code; - uint16 unicode; + uint32 unicode; } encoding_convert_entry; diff --git a/src/openrct2/localisation/Convert.cpp b/src/openrct2/localisation/Convert.cpp index 7a94a465ec..7818f99a21 100644 --- a/src/openrct2/localisation/Convert.cpp +++ b/src/openrct2/localisation/Convert.cpp @@ -78,7 +78,7 @@ static wchar_t encoding_convert_x_to_unicode(wchar_t code, const encoding_conver else return entry->unicode; } -wchar_t encoding_convert_unicode_to_rct2(wchar_t unicode) +char32_t encoding_convert_unicode_to_rct2(char32_t unicode) { // Can't do a binary search as it's sorted by RCT2 code, not unicode for (uint32 i = 0; i < Util::CountOf(RCT2ToUnicodeTable); i++) { diff --git a/src/openrct2/localisation/FormatCodes.h b/src/openrct2/localisation/FormatCodes.h index 8ea86472f1..6a0f0dc0dd 100644 --- a/src/openrct2/localisation/FormatCodes.h +++ b/src/openrct2/localisation/FormatCodes.h @@ -107,6 +107,7 @@ enum { FORMAT_COLOUR_CODE_END = FORMAT_PALESILVER, // Extra non-ASCII characters + FORMAT_INVERTEDEXCLAMATION = 161, FORMAT_POUND = 163, FORMAT_YEN = 165, FORMAT_COPYRIGHT = 169, @@ -136,11 +137,11 @@ enum { FORMAT_TICK = 10003, FORMAT_CROSS = 10005, + FORMAT_SYMBOL_RAILWAY = 128740, + FORMAT_SYMBOL_ROAD = 128739, + FORMAT_SYMBOL_FLAG = 128681, + // Format codes that need suitable Unicode allocations - FORMAT_SYMBOL_i = 20000, - FORMAT_SYMBOL_RAILWAY = 20001, - FORMAT_SYMBOL_ROAD = 20002, - FORMAT_SYMBOL_FLAG = 20003, FORMAT_COMMA1DP16 = 20004 }; diff --git a/src/openrct2/localisation/Localisation.h b/src/openrct2/localisation/Localisation.h index 3854846836..e00ea11653 100644 --- a/src/openrct2/localisation/Localisation.h +++ b/src/openrct2/localisation/Localisation.h @@ -17,6 +17,7 @@ #ifndef LOCALISATION_H #define LOCALISATION_H +#include #include "Currency.h" #include "Date.h" #include "FormatCodes.h" @@ -58,7 +59,7 @@ sint32 win1252_to_utf8(utf8string dst, const char *src, size_t srcLength, size_t sint32 rct2_to_utf8(utf8 *dst, const char *src); sint32 utf8_to_rct2(char *dst, const utf8 *src); wchar_t encoding_convert_rct2_to_unicode(wchar_t rct2str); -wchar_t encoding_convert_unicode_to_rct2(wchar_t unicode); +char32_t encoding_convert_unicode_to_rct2(char32_t unicode); wchar_t encoding_convert_gb2312_to_unicode(wchar_t gb2312); wchar_t encoding_convert_big5_to_unicode(wchar_t big5); wchar_t encoding_convert_cp932_to_unicode(wchar_t cp932);