mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
Fixed crashes when inviting same faction arena groups.
Fixed crash in BGEndedRemoveInvites (by setting queue type from deque to list). Signed-off-by: Triply <triply@getmangos.com>
This commit is contained in:
parent
f49ee9e157
commit
bb1d8d7bc7
3 changed files with 15 additions and 14 deletions
|
|
@ -396,12 +396,14 @@ void BattleGroundQueue::BGEndedRemoveInvites(BattleGround *bg)
|
|||
GroupsQueueType::iterator itr, next;
|
||||
for(uint32 i = 0; i < BG_QUEUE_GROUP_TYPES_COUNT; i++)
|
||||
{
|
||||
for(itr = m_QueuedGroups[queue_id][i].begin(); itr != m_QueuedGroups[queue_id][i].end(); itr = next)
|
||||
itr = m_QueuedGroups[queue_id][i].begin();
|
||||
next = itr;
|
||||
while (next != m_QueuedGroups[queue_id][i].end())
|
||||
{
|
||||
// must do this way, because the groupinfo will be deleted when all playerinfos are removed
|
||||
GroupQueueInfo * ginfo = (*itr);
|
||||
next = itr;
|
||||
itr = next;
|
||||
++next;
|
||||
GroupQueueInfo * ginfo = (*itr);
|
||||
// if group was invited to this bg instance, then remove all references
|
||||
if( ginfo->IsInvitedToBGInstanceGUID == bgInstanceId )
|
||||
{
|
||||
|
|
@ -525,7 +527,7 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BGQueueIdBasedOnLevel
|
|||
// this method checks if premade versus premade battleground is possible
|
||||
// then after 30 mins (default) in queue it moves premade group to normal queue
|
||||
// it tries to invite as much players as it can - to MaxPlayersPerTeam, because premade groups have more than MinPlayersPerTeam players
|
||||
bool BattleGroundQueue::CheckPremadeMatch(BGQueueIdBasedOnLevel queue_id, uint32 MaxPlayersPerTeam, uint32 MinPlayersPerTeam)
|
||||
bool BattleGroundQueue::CheckPremadeMatch(BGQueueIdBasedOnLevel queue_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam)
|
||||
{
|
||||
//check match
|
||||
if(!m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].empty() && !m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].empty())
|
||||
|
|
@ -582,11 +584,8 @@ bool BattleGroundQueue::CheckPremadeMatch(BGQueueIdBasedOnLevel queue_id, uint32
|
|||
}
|
||||
|
||||
//this function tries to create battleground or arena with MinPlayersPerTeam against MinPlayersPerTeam
|
||||
bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BGQueueIdBasedOnLevel queue_id)
|
||||
bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BGQueueIdBasedOnLevel queue_id, uint32 minPlayers, uint32 maxPlayers)
|
||||
{
|
||||
uint32 minPlayers = bg_template->GetMinPlayersPerTeam();
|
||||
uint32 maxPlayers = bg_template->GetMaxPlayersPerTeam();
|
||||
|
||||
GroupsQueueType::const_iterator itr_team[BG_TEAMS_COUNT];
|
||||
for(uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
{
|
||||
|
|
@ -727,7 +726,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
|
|||
if( bg_template->isBattleGround() )
|
||||
{
|
||||
//check if there is premade against premade match
|
||||
if( CheckPremadeMatch(queue_id, bg_template->GetMaxPlayersPerTeam(), bg_template->GetMinPlayersPerTeam()) )
|
||||
if( CheckPremadeMatch(queue_id, MinPlayersPerTeam, MaxPlayersPerTeam) )
|
||||
{
|
||||
//create new battleground
|
||||
BattleGround * bg2 = NULL;
|
||||
|
|
@ -752,7 +751,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
|
|||
if( !isRated )
|
||||
{
|
||||
// if there are enough players in pools, start new battleground or non rated arena
|
||||
if( CheckNormalMatch(bg_template, queue_id) )
|
||||
if( CheckNormalMatch(bg_template, queue_id, MinPlayersPerTeam, MaxPlayersPerTeam) )
|
||||
{
|
||||
// we successfully created a pool
|
||||
BattleGround * bg2 = NULL;
|
||||
|
|
@ -887,11 +886,13 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
|
|||
m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].push_front(*(itr_team[BG_TEAM_ALLIANCE]));
|
||||
// erase from horde queue
|
||||
m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].erase(itr_team[BG_TEAM_ALLIANCE]);
|
||||
itr_team[BG_TEAM_ALLIANCE] = m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].begin();
|
||||
}
|
||||
if( (*(itr_team[BG_TEAM_HORDE]))->Team != HORDE )
|
||||
{
|
||||
m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].push_front(*(itr_team[BG_TEAM_HORDE]));
|
||||
m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].erase(itr_team[BG_TEAM_HORDE]);
|
||||
itr_team[BG_TEAM_HORDE] = m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].begin();
|
||||
}
|
||||
|
||||
InviteGroupToBG(*(itr_team[BG_TEAM_ALLIANCE]), arena, ALLIANCE);
|
||||
|
|
|
|||
|
|
@ -72,8 +72,8 @@ class BattleGroundQueue
|
|||
void Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id, uint8 arenaType = 0, bool isRated = false, uint32 minRating = 0);
|
||||
|
||||
void FillPlayersToBG(BattleGround* bg, BGQueueIdBasedOnLevel queue_id);
|
||||
bool CheckPremadeMatch(BGQueueIdBasedOnLevel queue_id, uint32 MaxPlayersPerTeam, uint32 MinPlayersPerTeam);
|
||||
bool CheckNormalMatch(BattleGround* bg_template, BGQueueIdBasedOnLevel queue_id);
|
||||
bool CheckPremadeMatch(BGQueueIdBasedOnLevel queue_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam);
|
||||
bool CheckNormalMatch(BattleGround* bg_template, BGQueueIdBasedOnLevel queue_id, uint32 minPlayers, uint32 maxPlayers);
|
||||
GroupQueueInfo * AddGroup(Player * leader, BattleGroundTypeId bgTypeId, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 ArenaTeamId = 0);
|
||||
void AddPlayer(Player *plr, GroupQueueInfo *ginfo);
|
||||
void RemovePlayer(const uint64& guid, bool decreaseInvitedCount);
|
||||
|
|
@ -85,7 +85,7 @@ class BattleGroundQueue
|
|||
QueuedPlayersMap m_QueuedPlayers;
|
||||
|
||||
//we need constant add to begin and constant remove / add from the end, therefore deque suits our problem well
|
||||
typedef std::deque<GroupQueueInfo*> GroupsQueueType;
|
||||
typedef std::list<GroupQueueInfo*> GroupsQueueType;
|
||||
|
||||
/*
|
||||
This two dimensional array is used to store All queued groups
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "7354"
|
||||
#define REVISION_NR "7355"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue