[7370] Fixed crash in CheckSkirmishForSameFaction() function, when we erased iterator which shouldn't be erased
Fixed crash in BattleGroundQueue::Update() by changing BGFreeSlotQueueType from deque to list. Author: Triply --HG-- branch : trunk
This commit is contained in:
@@ -653,7 +653,8 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BGQueueIdBasedOnLevel queue_
|
|||||||
break;
|
break;
|
||||||
if( itr_team == m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].end() )
|
if( itr_team == m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].end() )
|
||||||
return false;
|
return false;
|
||||||
GroupsQueueType::iterator itr_team2 = ++itr_team;
|
GroupsQueueType::iterator itr_team2 = itr_team;
|
||||||
|
++itr_team2;
|
||||||
//invite players to other selection pool
|
//invite players to other selection pool
|
||||||
for(; itr_team2 != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].end(); ++itr_team2)
|
for(; itr_team2 != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].end(); ++itr_team2)
|
||||||
{
|
{
|
||||||
@@ -675,7 +676,9 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BGQueueIdBasedOnLevel queue_
|
|||||||
//add team to other queue
|
//add team to other queue
|
||||||
m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + otherTeam].push_front(*itr);
|
m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + otherTeam].push_front(*itr);
|
||||||
//remove team from old queue
|
//remove team from old queue
|
||||||
for(GroupsQueueType::iterator itr2 = itr_team; itr2 != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].end(); ++itr2)
|
GroupsQueueType::iterator itr2 = itr_team;
|
||||||
|
++itr2;
|
||||||
|
for(; itr2 != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].end(); ++itr2)
|
||||||
{
|
{
|
||||||
if( *itr2 == *itr )
|
if( *itr2 == *itr )
|
||||||
{
|
{
|
||||||
@@ -705,9 +708,8 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
|
|||||||
|
|
||||||
//battleground with free slot for player should be always in the beggining of the queue
|
//battleground with free slot for player should be always in the beggining of the queue
|
||||||
// maybe it would be better to create bgfreeslotqueue for each queue_id_based_on_level
|
// maybe it would be better to create bgfreeslotqueue for each queue_id_based_on_level
|
||||||
bool continueAdding = true;
|
|
||||||
BGFreeSlotQueueType::iterator itr, next;
|
BGFreeSlotQueueType::iterator itr, next;
|
||||||
for (itr = sBattleGroundMgr.BGFreeSlotQueue[bgTypeId].begin(); continueAdding && itr != sBattleGroundMgr.BGFreeSlotQueue[bgTypeId].end(); itr = next)
|
for (itr = sBattleGroundMgr.BGFreeSlotQueue[bgTypeId].begin(); itr != sBattleGroundMgr.BGFreeSlotQueue[bgTypeId].end(); itr = next)
|
||||||
{
|
{
|
||||||
next = itr;
|
next = itr;
|
||||||
++next;
|
++next;
|
||||||
@@ -733,8 +735,6 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
|
|||||||
|
|
||||||
if( !bg->HasFreeSlots() )
|
if( !bg->HasFreeSlots() )
|
||||||
{
|
{
|
||||||
if( next == sBattleGroundMgr.BGFreeSlotQueue[bgTypeId].end() )
|
|
||||||
continueAdding = false;
|
|
||||||
// remove BG from BGFreeSlotQueue
|
// remove BG from BGFreeSlotQueue
|
||||||
bg->RemoveFromBGFreeSlotQueue();
|
bg->RemoveFromBGFreeSlotQueue();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,8 @@
|
|||||||
|
|
||||||
typedef std::map<uint32, BattleGround*> BattleGroundSet;
|
typedef std::map<uint32, BattleGround*> BattleGroundSet;
|
||||||
|
|
||||||
typedef std::deque<BattleGround*> BGFreeSlotQueueType;
|
//this container can't be deque, because deque doesn't like removing the last element - if you remove it, it invalidates next iterator and crash appears
|
||||||
|
typedef std::list<BattleGround*> BGFreeSlotQueueType;
|
||||||
|
|
||||||
typedef UNORDERED_MAP<uint32, BattleGroundTypeId> BattleMastersMap;
|
typedef UNORDERED_MAP<uint32, BattleGroundTypeId> BattleMastersMap;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7369"
|
#define REVISION_NR "7370"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|||||||
Reference in New Issue
Block a user