From 598675ca8f30c3865f32fd85568e69e8df80fae3 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sun, 1 May 2022 17:59:52 +0200 Subject: [PATCH] Merge encoding_convert_rct2_to_unicode() with generic counterpart --- src/openrct2/localisation/ConversionTables.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/openrct2/localisation/ConversionTables.cpp b/src/openrct2/localisation/ConversionTables.cpp index 6aa142a0b4..6d6528e410 100644 --- a/src/openrct2/localisation/ConversionTables.cpp +++ b/src/openrct2/localisation/ConversionTables.cpp @@ -108,15 +108,10 @@ static int32_t encoding_search_compare(const void *pKey, const void *pEntry) return 0; } -static wchar_t encoding_convert_x_to_unicode(wchar_t code, const encoding_convert_entry *table, size_t count) -{ - encoding_convert_entry * entry = static_cast(std::bsearch(&code, table, count, sizeof(encoding_convert_entry), encoding_search_compare)); - if (entry == nullptr) - return code; - return entry->unicode; -} - wchar_t encoding_convert_rct2_to_unicode(wchar_t rct2str) { - return encoding_convert_x_to_unicode(rct2str, RCT2ToUnicodeTable, std::size(RCT2ToUnicodeTable)); + encoding_convert_entry * entry = static_cast(std::bsearch(&rct2str, RCT2ToUnicodeTable, std::size(RCT2ToUnicodeTable), sizeof(encoding_convert_entry), encoding_search_compare)); + if (entry == nullptr) + return rct2str; + return entry->unicode; }