From d076838747934fbeea4894bd14b6b173e1fe80f1 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Sun, 8 Jan 2023 09:01:14 -0800 Subject: [PATCH] fix implicit ptext length conversion --- src/ProxyCommands.cc | 2 +- src/Text.hh | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ProxyCommands.cc b/src/ProxyCommands.cc index 49e6671c..ef57db2f 100644 --- a/src/ProxyCommands.cc +++ b/src/ProxyCommands.cc @@ -1241,7 +1241,7 @@ static HandlerResult S_65_67_68(shared_ptr, } auto& p = session.lobby_players[index]; p.guild_card_number = cmd.entries[x].lobby_data.guild_card; - ptext name = cmd.entries[x].disp.name; + string name = encode_sjis(cmd.entries[x].disp.name); p.name = name; p.section_id = cmd.entries[x].disp.section_id; p.char_class = cmd.entries[x].disp.char_class; diff --git a/src/Text.hh b/src/Text.hh index 94c1c965..779bfeae 100644 --- a/src/Text.hh +++ b/src/Text.hh @@ -39,6 +39,11 @@ inline std::u16string decode_sjis(const std::string& s) { return decode_sjis(s.data(), s.size()); } +// These functions exist so that decode_sjis and encode_sjis can be +// indiscriminately used within templates that use different char types. +inline const std::string& encode_sjis(const std::string& s) { return s; } +inline const std::u16string& decode_sjis(const std::u16string& s) { return s; } + // (1b) Type-independent utility functions template