aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Battlefield/Battlefield.cpp
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2016-09-05 00:41:17 +0200
committerjoschiwald <joschiwald.trinity@gmail.com>2017-02-26 15:30:13 +0100
commit4957a17cb14ed189235ab0767c082fa3f8af3f52 (patch)
tree95fa02f5f976c9cf7dd217b842bd0731e1cbc54b /src/server/game/Battlefield/Battlefield.cpp
parent4d061e0b49d194d3f88f8acdd3875ad4dab6bd43 (diff)
Core/Battlefield: container optimization
(cherry picked from commit 932d31598d697bd6cdb4f83ec70018e789984948)
Diffstat (limited to 'src/server/game/Battlefield/Battlefield.cpp')
-rw-r--r--src/server/game/Battlefield/Battlefield.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp
index 7bd6b24a926..152b73e4cee 100644
--- a/src/server/game/Battlefield/Battlefield.cpp
+++ b/src/server/game/Battlefield/Battlefield.cpp
@@ -199,7 +199,7 @@ bool Battlefield::Update(uint32 diff)
void Battlefield::InvitePlayersInZoneToQueue()
{
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
- for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ for (auto itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
InvitePlayerToQueue(player);
}
@@ -217,7 +217,7 @@ void Battlefield::InvitePlayersInQueueToWar()
{
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
{
- for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr)
+ for (auto itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr)
{
if (Player* player = ObjectAccessor::FindPlayer(*itr))
{
@@ -236,7 +236,8 @@ void Battlefield::InvitePlayersInQueueToWar()
void Battlefield::InvitePlayersInZoneToWar()
{
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
- for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ {
+ for (auto itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
{
if (Player* player = ObjectAccessor::FindPlayer(*itr))
{
@@ -248,6 +249,7 @@ void Battlefield::InvitePlayersInZoneToWar()
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(nullptr) + 10;
}
}
+ }
}
void Battlefield::InvitePlayerToWar(Player* player)
@@ -293,7 +295,7 @@ void Battlefield::InitStalker(uint32 entry, Position const& pos)
void Battlefield::KickAfkPlayers()
{
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
- for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ for (auto itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
if (player->isAFK())
KickPlayerFromBattlefield(*itr);
@@ -394,13 +396,13 @@ void Battlefield::TeamCastSpell(TeamId team, int32 spellId)
{
if (spellId > 0)
{
- for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ for (auto itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
player->CastSpell(player, uint32(spellId), true);
}
else
{
- for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ for (auto itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
player->RemoveAuraFromStack(uint32(-spellId));
}
@@ -409,7 +411,7 @@ void Battlefield::TeamCastSpell(TeamId team, int32 spellId)
void Battlefield::BroadcastPacketToZone(WorldPacket const* data) const
{
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
- for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ for (auto itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
player->SendDirectMessage(data);
}
@@ -417,7 +419,7 @@ void Battlefield::BroadcastPacketToZone(WorldPacket const* data) const
void Battlefield::BroadcastPacketToQueue(WorldPacket const* data) const
{
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
- for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr)
+ for (auto itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr)
if (Player* player = ObjectAccessor::FindConnectedPlayer(*itr))
player->SendDirectMessage(data);
}
@@ -425,7 +427,7 @@ void Battlefield::BroadcastPacketToQueue(WorldPacket const* data) const
void Battlefield::BroadcastPacketToWar(WorldPacket const* data) const
{
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
- for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ for (auto itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
player->SendDirectMessage(data);
}
@@ -498,7 +500,7 @@ void Battlefield::ShowNpc(Creature* creature, bool aggressive)
// ****************************************************
Group* Battlefield::GetFreeBfRaid(TeamId TeamId)
{
- for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
+ for (auto itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
if (Group* group = sGroupMgr->GetGroupByGUID(*itr))
if (!group->IsFull())
return group;
@@ -508,7 +510,7 @@ Group* Battlefield::GetFreeBfRaid(TeamId TeamId)
Group* Battlefield::GetGroupPlayer(ObjectGuid guid, TeamId TeamId)
{
- for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
+ for (auto itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
if (Group* group = sGroupMgr->GetGroupByGUID(*itr))
if (group->IsMember(guid))
return group;