diff options
author | andrew <xdotftw@gmail.com> | 2014-01-21 14:58:17 +0100 |
---|---|---|
committer | andrew <xdotftw@gmail.com> | 2014-01-21 14:58:17 +0100 |
commit | aa61f55b743a8ecf3cd8e1f99e1d9a0308f6d014 (patch) | |
tree | 42e227cd81bced9bc42b4f686753ccbde1b95caa /src/World.cpp | |
parent | Scoreboard serialization (diff) | |
download | cuberite-aa61f55b743a8ecf3cd8e1f99e1d9a0308f6d014.tar cuberite-aa61f55b743a8ecf3cd8e1f99e1d9a0308f6d014.tar.gz cuberite-aa61f55b743a8ecf3cd8e1f99e1d9a0308f6d014.tar.bz2 cuberite-aa61f55b743a8ecf3cd8e1f99e1d9a0308f6d014.tar.lz cuberite-aa61f55b743a8ecf3cd8e1f99e1d9a0308f6d014.tar.xz cuberite-aa61f55b743a8ecf3cd8e1f99e1d9a0308f6d014.tar.zst cuberite-aa61f55b743a8ecf3cd8e1f99e1d9a0308f6d014.zip |
Diffstat (limited to '')
-rw-r--r-- | src/World.cpp | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/src/World.cpp b/src/World.cpp index 8e7b6171c..fb20e2242 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -242,7 +242,8 @@ cWorld::cWorld(const AString & a_WorldName) : m_Weather(eWeather_Sunny), m_WeatherInterval(24000), // Guaranteed 1 day of sunshine at server start :) m_GeneratorCallbacks(*this), - m_TickThread(*this) + m_TickThread(*this), + m_Scoreboard(this) { LOGD("cWorld::cWorld(\"%s\")", a_WorldName.c_str()); @@ -1982,6 +1983,60 @@ void cWorld::BroadcastRemoveEntityEffect(const cEntity & a_Entity, int a_EffectI +void cWorld::BroadcastScoreboardObjective(const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) +{ + cCSLock Lock(m_CSPlayers); + for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + cClientHandle * ch = (*itr)->GetClientHandle(); + if ((ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) + { + continue; + } + ch->SendScoreboardObjective(a_Name, a_DisplayName, a_Mode); + } +} + + + + + +void cWorld::BroadcastScoreUpdate(const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) +{ + cCSLock Lock(m_CSPlayers); + for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + cClientHandle * ch = (*itr)->GetClientHandle(); + if ((ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) + { + continue; + } + ch->SendScoreUpdate(a_Objective, a_Player, a_Score, a_Mode); + } +} + + + + + +void cWorld::BroadcastDisplayObjective(const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) +{ + cCSLock Lock(m_CSPlayers); + for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + cClientHandle * ch = (*itr)->GetClientHandle(); + if ((ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) + { + continue; + } + ch->SendDisplayObjective(a_Objective, a_Display); + } +} + + + + + void cWorld::BroadcastSoundEffect(const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude) { m_ChunkMap->BroadcastSoundEffect(a_SoundName, a_SrcX, a_SrcY, a_SrcZ, a_Volume, a_Pitch, a_Exclude); |