diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-09-18 18:50:17 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-09-18 18:50:17 +0200 |
commit | 43ed690520d3c3b47ed7ff6f48f868e8011565e0 (patch) | |
tree | 7db2b1b7dde37f498e6ed09e90a68ae3faff0718 /src/World.cpp | |
parent | 1.8: Simplified item metadata reading. (diff) | |
download | cuberite-43ed690520d3c3b47ed7ff6f48f868e8011565e0.tar cuberite-43ed690520d3c3b47ed7ff6f48f868e8011565e0.tar.gz cuberite-43ed690520d3c3b47ed7ff6f48f868e8011565e0.tar.bz2 cuberite-43ed690520d3c3b47ed7ff6f48f868e8011565e0.tar.lz cuberite-43ed690520d3c3b47ed7ff6f48f868e8011565e0.tar.xz cuberite-43ed690520d3c3b47ed7ff6f48f868e8011565e0.tar.zst cuberite-43ed690520d3c3b47ed7ff6f48f868e8011565e0.zip |
Diffstat (limited to '')
-rw-r--r-- | src/World.cpp | 78 |
1 files changed, 75 insertions, 3 deletions
diff --git a/src/World.cpp b/src/World.cpp index 2d2137b3f..71ce7e680 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -2153,7 +2153,7 @@ void cWorld::BroadcastParticleEffect(const AString & a_ParticleName, float a_Src -void cWorld::BroadcastPlayerListItem(const cPlayer & a_Player, char a_Action, const cClientHandle * a_Exclude) +void cWorld::BroadcastPlayerListAddPlayer(const cPlayer & a_Player, const cClientHandle * a_Exclude) { cCSLock Lock(m_CSPlayers); for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) @@ -2163,7 +2163,79 @@ void cWorld::BroadcastPlayerListItem(const cPlayer & a_Player, char a_Action, co { continue; } - ch->SendPlayerListItem(a_Player, a_Action); + ch->SendPlayerListAddPlayer(a_Player); + } +} + + + + + +void cWorld::BroadcastPlayerListRemovePlayer(const cPlayer & a_Player, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSPlayers); + for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + cClientHandle * ch = (*itr)->GetClientHandle(); + if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) + { + continue; + } + ch->SendPlayerListRemovePlayer(a_Player); + } +} + + + + + +void cWorld::BroadcastPlayerListUpdateGameMode(const cPlayer & a_Player, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSPlayers); + for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + cClientHandle * ch = (*itr)->GetClientHandle(); + if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) + { + continue; + } + ch->SendPlayerListUpdateGameMode(a_Player); + } +} + + + + + +void cWorld::BroadcastPlayerListUpdatePing(const cPlayer & a_Player, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSPlayers); + for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + cClientHandle * ch = (*itr)->GetClientHandle(); + if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) + { + continue; + } + ch->SendPlayerListUpdatePing(a_Player); + } +} + + + + + +void cWorld::BroadcastPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSPlayers); + for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + cClientHandle * ch = (*itr)->GetClientHandle(); + if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) + { + continue; + } + ch->SendPlayerListUpdateDisplayName(a_Player, a_OldListName); } } @@ -2686,7 +2758,7 @@ void cWorld::SendPlayerList(cPlayer * a_DestPlayer) cClientHandle * ch = (*itr)->GetClientHandle(); if ((ch != NULL) && !ch->IsDestroyed()) { - a_DestPlayer->GetClientHandle()->SendPlayerListItem(*(*itr), 0); + a_DestPlayer->GetClientHandle()->SendPlayerListAddPlayer(*(*itr)); } } } |