Allow the server to send a global notice to all players (for example if a server reboot is going to happen). Does not work with current client version 0.6.3.

This commit is contained in:
lotodore
2008-12-26 13:50:09 +00:00
parent 5623e0865d
commit 4f48fdbe2a
4 changed files with 50 additions and 6 deletions
+13 -3
View File
@@ -691,9 +691,19 @@ AbstractClientStateReceiving::Process(ClientThread &client)
NetPacketChatText::Data chatData;
tmpPacket->ToNetPacketChatText()->GetData(chatData);
boost::shared_ptr<PlayerData> tmpPlayer = client.GetPlayerDataByUniqueId(chatData.playerId);
if (tmpPlayer.get())
client.GetCallback().SignalNetClientChatMsg(tmpPlayer->GetName(), chatData.text);
string playerName;
if (chatData.playerId == 0)
{
playerName = "(global notice)";
}
else
{
boost::shared_ptr<PlayerData> tmpPlayer = client.GetPlayerDataByUniqueId(chatData.playerId);
if (tmpPlayer.get())
playerName = tmpPlayer->GetName();
}
if (!playerName.empty())
client.GetCallback().SignalNetClientChatMsg(playerName, chatData.text);
}
else if (tmpPacket->ToNetPacketPlayerLeft())
{