*Massive cleanup redux.
--HG-- branch : trunk
This commit is contained in:
+26
-28
@@ -36,7 +36,6 @@
|
||||
#include "SpellAuras.h"
|
||||
#include "Util.h"
|
||||
|
||||
|
||||
namespace MaNGOS
|
||||
{
|
||||
class BattleGroundChatBuilder
|
||||
@@ -122,7 +121,7 @@ namespace MaNGOS
|
||||
template<class Do>
|
||||
void BattleGround::BroadcastWorker(Do& _do)
|
||||
{
|
||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
if (Player *plr = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)))
|
||||
_do(plr);
|
||||
}
|
||||
@@ -206,11 +205,11 @@ BattleGround::~BattleGround()
|
||||
// remove objects and creatures
|
||||
// (this is done automatically in mapmanager update, when the instance is reset after the reset time)
|
||||
int size = m_BgCreatures.size();
|
||||
for(int i = 0; i < size; ++i)
|
||||
for (int i = 0; i < size; ++i)
|
||||
DelCreature(i);
|
||||
|
||||
size = m_BgObjects.size();
|
||||
for(int i = 0; i < size; ++i)
|
||||
for (int i = 0; i < size; ++i)
|
||||
DelObject(i);
|
||||
|
||||
if (GetInstanceID()) // not spam by useless queries in case BG templates
|
||||
@@ -231,7 +230,7 @@ BattleGround::~BattleGround()
|
||||
// remove from bg free slot queue
|
||||
this->RemoveFromBGFreeSlotQueue();
|
||||
|
||||
for(BattleGroundScoreMap::const_iterator itr = m_PlayerScores.begin(); itr != m_PlayerScores.end(); ++itr)
|
||||
for (BattleGroundScoreMap::const_iterator itr = m_PlayerScores.begin(); itr != m_PlayerScores.end(); ++itr)
|
||||
delete itr->second;
|
||||
}
|
||||
|
||||
@@ -279,10 +278,10 @@ void BattleGround::Update(uint32 diff)
|
||||
{
|
||||
if (GetReviveQueueSize())
|
||||
{
|
||||
for(std::map<uint64, std::vector<uint64> >::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr)
|
||||
for (std::map<uint64, std::vector<uint64> >::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr)
|
||||
{
|
||||
Creature *sh = NULL;
|
||||
for(std::vector<uint64>::const_iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2)
|
||||
for (std::vector<uint64>::const_iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(*itr2);
|
||||
if (!plr)
|
||||
@@ -313,7 +312,7 @@ void BattleGround::Update(uint32 diff)
|
||||
}
|
||||
else if (m_LastResurrectTime > 500) // Resurrect players only half a second later, to see spirit heal effect on NPC
|
||||
{
|
||||
for(std::vector<uint64>::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
|
||||
for (std::vector<uint64>::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(*itr);
|
||||
if (!plr)
|
||||
@@ -423,13 +422,13 @@ void BattleGround::Update(uint32 diff)
|
||||
{
|
||||
//TODO : add arena sound PlaySoundToAll(SOUND_ARENA_START);
|
||||
|
||||
for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
if (Player *plr = objmgr.GetPlayer(itr->first))
|
||||
{
|
||||
plr->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION);
|
||||
// remove auras with duration lower than 30s
|
||||
Unit::AuraMap & aurMap = plr->GetAuras();
|
||||
for(Unit::AuraMap::iterator iter = aurMap.begin(); iter != aurMap.end();)
|
||||
for (Unit::AuraMap::iterator iter = aurMap.begin(); iter != aurMap.end(); )
|
||||
{
|
||||
if (!iter->second->IsPermanent()
|
||||
&& iter->second->GetAuraDuration()<=30*IN_MILISECONDS
|
||||
@@ -451,7 +450,7 @@ void BattleGround::Update(uint32 diff)
|
||||
|
||||
PlaySoundToAll(SOUND_BG_START);
|
||||
|
||||
for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
if (Player* plr = objmgr.GetPlayer(itr->first))
|
||||
plr->RemoveAurasDueToSpell(SPELL_PREPARATION);
|
||||
//Announce BG starting
|
||||
@@ -475,7 +474,7 @@ void BattleGround::Update(uint32 diff)
|
||||
{
|
||||
m_EndTime = 0;
|
||||
BattleGroundPlayerMap::iterator itr, next;
|
||||
for(itr = m_Players.begin(); itr != m_Players.end(); itr = next)
|
||||
for (itr = m_Players.begin(); itr != m_Players.end(); itr = next)
|
||||
{
|
||||
next = itr;
|
||||
++next;
|
||||
@@ -501,7 +500,7 @@ void BattleGround::SetTeamStartLoc(uint32 TeamID, float X, float Y, float Z, flo
|
||||
|
||||
void BattleGround::SendPacketToAll(WorldPacket *packet)
|
||||
{
|
||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
if (plr)
|
||||
@@ -513,7 +512,7 @@ void BattleGround::SendPacketToAll(WorldPacket *packet)
|
||||
|
||||
void BattleGround::SendPacketToTeam(uint32 TeamID, WorldPacket *packet, Player *sender, bool self)
|
||||
{
|
||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
|
||||
@@ -545,7 +544,7 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, uint32 TeamID)
|
||||
{
|
||||
WorldPacket data;
|
||||
|
||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
|
||||
@@ -568,7 +567,7 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, uint32 TeamID)
|
||||
|
||||
void BattleGround::CastSpellOnTeam(uint32 SpellID, uint32 TeamID)
|
||||
{
|
||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
|
||||
@@ -588,7 +587,7 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, uint32 TeamID)
|
||||
|
||||
void BattleGround::YellToAll(Creature* creature, const char* text, uint32 language)
|
||||
{
|
||||
for(std::map<uint64, BattleGroundPlayer>::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
for (std::map<uint64, BattleGroundPlayer>::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
@@ -602,10 +601,9 @@ void BattleGround::YellToAll(Creature* creature, const char* text, uint32 langua
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BattleGround::RewardHonorToTeam(uint32 Honor, uint32 TeamID)
|
||||
{
|
||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
|
||||
@@ -630,7 +628,7 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
|
||||
if (!factionEntry)
|
||||
return;
|
||||
|
||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
|
||||
@@ -721,7 +719,7 @@ void BattleGround::EndBattleGround(uint32 winner)
|
||||
}
|
||||
}
|
||||
|
||||
for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
for (BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
uint32 team = itr->second.Team;
|
||||
@@ -1125,7 +1123,7 @@ void BattleGround::Reset()
|
||||
|
||||
m_Players.clear();
|
||||
|
||||
for(BattleGroundScoreMap::const_iterator itr = m_PlayerScores.begin(); itr != m_PlayerScores.end(); ++itr)
|
||||
for (BattleGroundScoreMap::const_iterator itr = m_PlayerScores.begin(); itr != m_PlayerScores.end(); ++itr)
|
||||
delete itr->second;
|
||||
m_PlayerScores.clear();
|
||||
|
||||
@@ -1251,7 +1249,7 @@ void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid,
|
||||
void BattleGround::EventPlayerLoggedIn(Player* player, uint64 plr_guid)
|
||||
{
|
||||
// player is correct pointer
|
||||
for(std::deque<uint64>::iterator itr = m_OfflineQueue.begin(); itr != m_OfflineQueue.end(); ++itr)
|
||||
for (std::deque<uint64>::iterator itr = m_OfflineQueue.begin(); itr != m_OfflineQueue.end(); ++itr)
|
||||
{
|
||||
if (*itr == plr_guid)
|
||||
{
|
||||
@@ -1427,9 +1425,9 @@ void BattleGround::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid
|
||||
|
||||
void BattleGround::RemovePlayerFromResurrectQueue(uint64 player_guid)
|
||||
{
|
||||
for(std::map<uint64, std::vector<uint64> >::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr)
|
||||
for (std::map<uint64, std::vector<uint64> >::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr)
|
||||
{
|
||||
for(std::vector<uint64>::iterator itr2 =(itr->second).begin(); itr2 != (itr->second).end(); ++itr2)
|
||||
for (std::vector<uint64>::iterator itr2 =(itr->second).begin(); itr2 != (itr->second).end(); ++itr2)
|
||||
{
|
||||
if (*itr2 == player_guid)
|
||||
{
|
||||
@@ -1790,7 +1788,7 @@ void BattleGround::HandleKillPlayer( Player *player, Player *killer )
|
||||
UpdatePlayerScore(killer, SCORE_HONORABLE_KILLS, 1);
|
||||
UpdatePlayerScore(killer, SCORE_KILLING_BLOWS, 1);
|
||||
|
||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
|
||||
@@ -1850,7 +1848,7 @@ void BattleGround::PlayerAddedToBGCheckIfBGIsRunning(Player* plr)
|
||||
uint32 BattleGround::GetAlivePlayersCountByTeam(uint32 Team) const
|
||||
{
|
||||
int count = 0;
|
||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
if (itr->second.Team == Team)
|
||||
{
|
||||
@@ -1872,7 +1870,7 @@ void BattleGround::SetHoliday(bool is_holiday)
|
||||
|
||||
int32 BattleGround::GetObjectType(uint64 guid)
|
||||
{
|
||||
for(uint32 i = 0; i < m_BgObjects.size(); ++i)
|
||||
for (uint32 i = 0; i < m_BgObjects.size(); ++i)
|
||||
if(m_BgObjects[i] == guid)
|
||||
return i;
|
||||
sLog.outError("BattleGround: cheating? a player used a gameobject which isnt supposed to be a usable object!");
|
||||
|
||||
Reference in New Issue
Block a user