summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ClientHandle.cpp2
-rw-r--r--src/Root.cpp13
-rw-r--r--src/Root.h4
3 files changed, 15 insertions, 4 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 161bdeb9d..9cba5619d 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -381,7 +381,7 @@ void cClientHandle::Authenticate(const AString & a_Name, const AString & a_UUID,
// Send player list items
SendPlayerListAddPlayer(*m_Player);
- World->BroadcastPlayerListAddPlayer(*m_Player);
+ cRoot::Get()->BroadcastPlayerListsAddPlayer(*m_Player);
cRoot::Get()->SendPlayerLists(m_Player);
m_Player->Initialize(*World);
diff --git a/src/Root.cpp b/src/Root.cpp
index b60f6ae3a..54e65b6da 100644
--- a/src/Root.cpp
+++ b/src/Root.cpp
@@ -560,14 +560,23 @@ void cRoot::SaveAllChunks(void)
void cRoot::SendPlayerLists(cPlayer * a_DestPlayer)
{
- for (WorldMap::iterator itr = m_WorldsByName.begin(), end = m_WorldsByName.end(); itr != end; ++itr)
+ for (const auto & itr : m_WorldsByName)
{
- itr->second->SendPlayerList(a_DestPlayer);
+ itr.second->SendPlayerList(a_DestPlayer);
} // for itr - m_WorldsByName[]
}
+void cRoot::BroadcastPlayerListsAddPlayer(const cPlayer & a_Player, const cClientHandle * a_Exclude)
+{
+ for (const auto & itr : m_WorldsByName)
+ {
+ itr.second->BroadcastPlayerListAddPlayer(a_Player);
+ } // for itr - m_WorldsByName[]
+}
+
+
void cRoot::BroadcastChat(const AString & a_Message, eMessageType a_ChatPrefix)
{
for (WorldMap::iterator itr = m_WorldsByName.begin(), end = m_WorldsByName.end(); itr != end; ++itr)
diff --git a/src/Root.h b/src/Root.h
index 73fd6638c..81551a503 100644
--- a/src/Root.h
+++ b/src/Root.h
@@ -147,7 +147,9 @@ public:
/** Send playerlist of all worlds to player */
void SendPlayerLists(cPlayer * a_DestPlayer);
-
+
+ /** Broadcast Player through all worlds */
+ void BroadcastPlayerListsAddPlayer(const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr);
// tolua_begin