aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Battlegrounds/Battleground.cpp18
-rw-r--r--src/server/game/Battlegrounds/Battleground.h2
2 files changed, 7 insertions, 13 deletions
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index c3742885268..f7cfa54efa2 100644
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -673,15 +673,13 @@ void Battleground::SendPacketToAll(WorldPacket const* packet) const
player->SendDirectMessage(packet);
}
-void Battleground::SendPacketToTeam(uint32 TeamID, WorldPacket const* packet, Player* sender, bool self) const
+void Battleground::SendPacketToTeam(uint32 teamId, WorldPacket const* packet, Player* except /*= nullptr*/) const
{
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
- if (Player* player = _GetPlayerForTeam(TeamID, itr, "SendPacketToTeam"))
- {
- if (self || sender != player)
+ if (Player* player = _GetPlayerForTeam(teamId, itr, "SendPacketToTeam"))
+ if (player != except)
player->SendDirectMessage(packet);
- }
}
}
@@ -697,11 +695,7 @@ void Battleground::PlaySoundToAll(uint32 soundID)
void Battleground::PlaySoundToTeam(uint32 soundID, uint32 teamID)
{
- for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
- {
- if (Player* player = _GetPlayerForTeam(teamID, itr, "PlaySoundToTeam"))
- player->SendDirectMessage(WorldPackets::Misc::PlaySound(ObjectGuid::Empty, soundID).Write());
- }
+ SendPacketToTeam(teamID, WorldPackets::Misc::PlaySound(ObjectGuid::Empty, soundID).Write());
}
void Battleground::CastSpellOnTeam(uint32 SpellID, uint32 TeamID)
@@ -1024,7 +1018,7 @@ void Battleground::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
// Let others know
WorldPackets::Battleground::BattlegroundPlayerLeft playerLeft;
playerLeft.Guid = guid;
- SendPacketToTeam(team, playerLeft.Write(), player, false);
+ SendPacketToTeam(team, playerLeft.Write(), player);
}
if (player)
@@ -1114,7 +1108,7 @@ void Battleground::AddPlayer(Player* player)
WorldPackets::Battleground::BattlegroundPlayerJoined playerJoined;
playerJoined.Guid = player->GetGUID();
- SendPacketToTeam(team, playerJoined.Write(), player, false);
+ SendPacketToTeam(team, playerJoined.Write(), player);
// BG Status packet
BattlegroundQueueTypeId bgQueueTypeId = sBattlegroundMgr->BGQueueTypeId(m_TypeID, GetArenaType());
diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h
index 0dee46ef125..8edacecd23c 100644
--- a/src/server/game/Battlegrounds/Battleground.h
+++ b/src/server/game/Battlegrounds/Battleground.h
@@ -376,7 +376,7 @@ class TC_GAME_API Battleground
// Packet Transfer
// method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!)
virtual void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& /*data*/) { }
- void SendPacketToTeam(uint32 TeamID, WorldPacket const* packet, Player* sender = NULL, bool self = true) const;
+ void SendPacketToTeam(uint32 teamId, WorldPacket const* packet, Player* except = nullptr) const;
void SendPacketToAll(WorldPacket const* packet) const;
void SendChatMessage(Creature* source, uint8 textId, WorldObject* target = NULL);