mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-11 08:49:50 +00:00
Codechange: use C++ style methods to combine a Utf8Encoded character and a formatted string
This commit is contained in:
parent
6ae6b65edb
commit
c158089eff
@ -248,7 +248,6 @@ void NetworkTextMessage(NetworkAction action, TextColour colour, bool self_send,
|
|||||||
default: strid = STR_NETWORK_CHAT_ALL; break;
|
default: strid = STR_NETWORK_CHAT_ALL; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
char message[1024];
|
|
||||||
SetDParamStr(0, name);
|
SetDParamStr(0, name);
|
||||||
SetDParamStr(1, str);
|
SetDParamStr(1, str);
|
||||||
SetDParam(2, data);
|
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
|
* 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
|
* 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. */
|
* 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);
|
std::ostringstream stream;
|
||||||
GetString(msg_ptr, strid, lastof(message));
|
std::ostreambuf_iterator<char> 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);
|
Debug(desync, 1, "msg: {:08x}; {:02x}; {}", TimerGameCalendar::date, TimerGameCalendar::date_fract, message);
|
||||||
IConsolePrint(colour, message);
|
IConsolePrint(colour, message);
|
||||||
|
Loading…
Reference in New Issue
Block a user