diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index cf473359e..30026df8a 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -1459,13 +1459,14 @@ uint32 BattleGroundMgr::CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeI // the following works, because std::set is default ordered with "<" // the optimalization would be to use as bitmask std::vector - but that would only make code unreadable uint32 lastId = 0; - for(std::set::iterator itr = m_ClientBattleGroundIds[bgTypeId][bracket_id].begin(); itr != m_ClientBattleGroundIds[bgTypeId][bracket_id].end();) + ClientBattleGroundIdSet& ids = m_ClientBattleGroundIds[bgTypeId][bracket_id]; + for(ClientBattleGroundIdSet::const_iterator itr = ids.begin(); itr != ids.end();) { if( (++lastId) != *itr) //if there is a gap between the ids, we will break.. break; lastId = *itr; } - m_ClientBattleGroundIds[bgTypeId][bracket_id].insert(lastId + 1); + ids.insert(lastId + 1); return lastId + 1; } @@ -1831,7 +1832,8 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, ObjectGuid if(PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgTemplate->GetMapId(),plr->getLevel())) { BattleGroundBracketId bracketId = bracketEntry->GetBracketId(); - for(std::set::iterator itr = m_ClientBattleGroundIds[bgTypeId][bracketId].begin(); itr != m_ClientBattleGroundIds[bgTypeId][bracketId].end();++itr) + ClientBattleGroundIdSet const& ids = m_ClientBattleGroundIds[bgTypeId][bracketId]; + for(ClientBattleGroundIdSet::const_iterator itr = ids.begin(); itr != ids.end();++itr) { *data << uint32(*itr); ++count; diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h index 9b73837c9..632941c1d 100644 --- a/src/game/BattleGroundMgr.h +++ b/src/game/BattleGroundMgr.h @@ -216,8 +216,7 @@ class BattleGroundMgr uint32 CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id); void DeleteClientVisibleInstanceId(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id, uint32 clientInstanceID) { - if (!m_ClientBattleGroundIds[bgTypeId][bracket_id].empty()) - m_ClientBattleGroundIds[bgTypeId][bracket_id].erase(clientInstanceID); + m_ClientBattleGroundIds[bgTypeId][bracket_id].erase(clientInstanceID); } void CreateInitialBattleGrounds(); @@ -287,7 +286,8 @@ class BattleGroundMgr /* Battlegrounds */ BattleGroundSet m_BattleGrounds[MAX_BATTLEGROUND_TYPE_ID]; std::vector m_QueueUpdateScheduler; - std::set m_ClientBattleGroundIds[MAX_BATTLEGROUND_TYPE_ID][MAX_BATTLEGROUND_BRACKETS]; //the instanceids just visible for the client + typedef std::set ClientBattleGroundIdSet; + ClientBattleGroundIdSet m_ClientBattleGroundIds[MAX_BATTLEGROUND_TYPE_ID][MAX_BATTLEGROUND_BRACKETS]; //the instanceids just visible for the client uint32 m_NextRatingDiscardUpdate; time_t m_NextAutoDistributionTime; uint32 m_AutoDistributionTimeChecker; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 3fa79ef98..065084a64 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11428" + #define REVISION_NR "11429" #endif // __REVISION_NR_H__