MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / NetworkAddChatMessage

Function NetworkAddChatMessage

src/network/network_chat_gui.cpp:85–98  ·  view source on GitHub ↗

* Add a text message to the 'chat window' to be shown * @param colour The colour this message is to be shown in * @param duration The duration of the chat message in seconds * @param message message itself */

Source from the content-addressed store, hash-verified

83 * @param message message itself
84 */
85void CDECL NetworkAddChatMessage(TextColour colour, uint duration, const std::string &message)
86{
87 if (_chatmsg_list.size() == MAX_CHAT_MESSAGES) {
88 _chatmsg_list.pop_back();
89 }
90
91 ChatMessage *cmsg = &_chatmsg_list.emplace_front();
92 cmsg->message = message;
93 cmsg->colour = colour;
94 cmsg->remove_time = std::chrono::steady_clock::now() + std::chrono::seconds(duration);
95
96 _chatmessage_dirty_time = std::chrono::steady_clock::now();
97 _chatmessage_dirty = true;
98}
99
100/** Initialize all font-dependent chat box sizes. */
101void NetworkReInitChatBoxSize()

Callers 1

NetworkTextMessageFunction · 0.85

Calls 3

nowClass · 0.85
pop_backMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected