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

Method SendChat

src/network/network_server.cpp:680–696  ·  view source on GitHub ↗

* Send a chat message. * @param action The action associated with the message. * @param client_id The origin of the chat message. * @param self_send Whether we did send the message. * @param msg The actual message. * @param data Arbitrary extra data. */

Source from the content-addressed store, hash-verified

678 * @param data Arbitrary extra data.
679 */
680NetworkRecvStatus ServerNetworkGameSocketHandler::SendChat(NetworkAction action, ClientID client_id, bool self_send, std::string_view msg, int64_t data)
681{
682 Debug(net, 9, "client[{}] SendChat(): action={}, client_id={}, self_send={}", this->client_id, action, client_id, self_send);
683
684 if (this->status < STATUS_PRE_ACTIVE) return NETWORK_RECV_STATUS_OKAY;
685
686 auto p = std::make_unique<Packet>(this, PACKET_SERVER_CHAT);
687
688 p->Send_uint8 (action);
689 p->Send_uint32(client_id);
690 p->Send_bool (self_send);
691 p->Send_string(msg);
692 p->Send_uint64(data);
693
694 this->SendPacket(std::move(p));
695 return NETWORK_RECV_STATUS_OKAY;
696}
697
698/**
699 * Send a chat message from external source.

Callers 1

NetworkServerSendChatFunction · 0.45

Calls 6

Send_uint32Method · 0.80
Send_boolMethod · 0.80
Send_stringMethod · 0.80
Send_uint64Method · 0.80
Send_uint8Method · 0.45
SendPacketMethod · 0.45

Tested by

no test coverage detected