1
0

Fixed the way connecting clients receive player lists and broadcast chat to worlds

This commit is contained in:
b33duck 2015-05-28 13:17:21 -07:00
parent e7214dff65
commit c8b1778847
3 changed files with 14 additions and 4 deletions

View File

@ -382,7 +382,7 @@ void cClientHandle::Authenticate(const AString & a_Name, const AString & a_UUID,
// Send player list items
SendPlayerListAddPlayer(*m_Player);
World->BroadcastPlayerListAddPlayer(*m_Player);
World->SendPlayerList(m_Player);
cRoot::Get()->SendPlayerLists(m_Player);
m_Player->Initialize(*World);
m_State = csAuthenticated;
@ -1475,7 +1475,7 @@ void cClientHandle::HandleChat(const AString & a_Message)
Msg.AddTextPart(AString("<") + m_Player->GetName() + "> ", Color);
Msg.ParseText(Message);
Msg.UnderlineUrls();
m_Player->GetWorld()->BroadcastChat(Msg);
cRoot::Get()->BroadcastChat(Msg);
}

View File

@ -558,6 +558,14 @@ void cRoot::SaveAllChunks(void)
void cRoot::SendPlayerLists(cPlayer * a_DestPlayer)
{
for (WorldMap::iterator itr = m_WorldsByName.begin(), end = m_WorldsByName.end(); itr != end; ++itr)
{
itr->second->SendPlayerList(a_DestPlayer);
} // for itr - m_WorldsByName[]
}
void cRoot::BroadcastChat(const AString & a_Message, eMessageType a_ChatPrefix)
@ -582,8 +590,6 @@ void cRoot::BroadcastChat(const cCompositeChat & a_Message)
bool cRoot::ForEachPlayer(cPlayerListCallback & a_Callback)
{
for (WorldMap::iterator itr = m_WorldsByName.begin(), itr2 = itr; itr != m_WorldsByName.end(); itr = itr2)

View File

@ -145,6 +145,10 @@ public:
/** Finds the player using it's complete username and calls the callback */
bool DoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback);
/** Send playerlist of all worlds to player */
void SendPlayerLists(cPlayer * a_DestPlayer);
// tolua_begin
/// Sends a chat message to all connected clients (in all worlds)