diff --git a/src/network/network.cpp b/src/network/network.cpp index 561c1df7fd..3f76ef8413 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -248,7 +248,6 @@ void NetworkTextMessage(NetworkAction action, TextColour colour, bool self_send, default: strid = STR_NETWORK_CHAT_ALL; break; } - char message[1024]; SetDParamStr(0, name); SetDParamStr(1, str); SetDParam(2, data); @@ -258,8 +257,10 @@ void NetworkTextMessage(NetworkAction action, TextColour colour, bool self_send, * right-to-left characters depending on the context. As the next text might be an user's name, the * user name's characters will influence the direction of the "***" instead of the language setting * of the game. Manually set the direction of the "***" by inserting a text-direction marker. */ - char *msg_ptr = message + Utf8Encode(message, _current_text_dir == TD_LTR ? CHAR_TD_LRM : CHAR_TD_RLM); - GetString(msg_ptr, strid, lastof(message)); + std::ostringstream stream; + std::ostreambuf_iterator iterator(stream); + Utf8Encode(iterator, _current_text_dir == TD_LTR ? CHAR_TD_LRM : CHAR_TD_RLM); + std::string message = stream.str() + GetString(strid); Debug(desync, 1, "msg: {:08x}; {:02x}; {}", TimerGameCalendar::date, TimerGameCalendar::date_fract, message); IConsolePrint(colour, message);