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

Function SendChat

src/openrct2/network/NetworkBase.cpp:3952–3978  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3950 }
3951
3952 void SendChat(const char* text, const std::vector<uint8_t>& playerIds)
3953 {
3954 auto& network = GetContext()->GetNetwork();
3955 if (network.GetMode() == Mode::client)
3956 {
3957 network.Client_Send_CHAT(text);
3958 }
3959 else if (network.GetMode() == Mode::server)
3960 {
3961 std::string message = text;
3962 if (ProcessChatMessagePluginHooks(network.GetPlayerID(), message))
3963 {
3964 auto player = network.GetPlayerByID(network.GetPlayerID());
3965 if (player != nullptr)
3966 {
3967 auto formatted = network.FormatChat(player, message.c_str());
3968 if (playerIds.empty()
3969 || std::find(playerIds.begin(), playerIds.end(), network.GetPlayerID()) != playerIds.end())
3970 {
3971 // Server is one of the recipients
3972 ChatAddHistory(formatted);
3973 }
3974 network.ServerSendChat(formatted, playerIds);
3975 }
3976 }
3977 }
3978 }
3979
3980 void SendGameAction(const GameActions::GameAction* action)
3981 {

Callers 3

ChatInputFunction · 0.85
ConsoleCommandSayFunction · 0.85
sendMessageMethod · 0.85

Calls 12

GetContextFunction · 0.85
ChatAddHistoryFunction · 0.85
GetModeMethod · 0.80
Client_Send_CHATMethod · 0.80
GetPlayerIDMethod · 0.80
GetPlayerByIDMethod · 0.80
FormatChatMethod · 0.80
ServerSendChatMethod · 0.80
endMethod · 0.65
emptyMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected