MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / sendMsg

Method sendMsg

source/network/ODServer.cpp:250–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248}
249
250void ODServer::sendMsg(Player* player, ODPacket& packet)
251{
252 if(player == nullptr)
253 {
254 // If player is nullptr, we send the message to every connected player
255 for (ODSocketClient* client : mSockClients)
256 client->send(packet);
257
258 return;
259 }
260
261 ODSocketClient* client = getClientFromPlayer(player);
262 if((client == nullptr) &&
263 (std::find(mDisconnectedPlayers.begin(), mDisconnectedPlayers.end(), player) == mDisconnectedPlayers.end()))
264 {
265 ServerNotificationType type;
266 OD_ASSERT_TRUE(packet >> type);
267 OD_ASSERT_TRUE_MSG(client != nullptr, "player=" + player->getNick()
268 + ", ServerNotificationType=" + ServerNotification::typeString(type));
269 return;
270 }
271
272 if(client != nullptr)
273 client->send(packet);
274}
275
276void ODServer::handleConsoleCommand(Player* player, GameMap* gameMap, const std::vector<std::string>& args)
277{

Callers

nothing calls this directly

Calls 1

sendMethod · 0.80

Tested by

no test coverage detected