mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-16 11:33:03 +01:00
Merge encoding_convert_rct2_to_unicode() with generic counterpart
This commit is contained in:
@@ -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<encoding_convert_entry *>(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<encoding_convert_entry *>(std::bsearch(&rct2str, RCT2ToUnicodeTable, std::size(RCT2ToUnicodeTable), sizeof(encoding_convert_entry), encoding_search_compare));
|
||||
if (entry == nullptr)
|
||||
return rct2str;
|
||||
return entry->unicode;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user