[11429] Cleanup code for m_ClientBattleGroundIds.

This commit is contained in:
VladimirMangos 2011-05-04 15:28:37 +04:00
parent 75a9379fa7
commit e47031b55c
3 changed files with 9 additions and 7 deletions

View file

@ -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<uint32> - but that would only make code unreadable
uint32 lastId = 0;
for(std::set<uint32>::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<uint32>::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;