fix(Core/Battleground): fix queue issue (#3116)
* Remove useless code that was only causing issue to the BG queue * Prevent new Battlegrounds to start if there are already other Battlegrounds that have free slots Co-authored-by Yehonal <yehonal.azeroth@gmail.com>
This commit is contained in:
@@ -106,7 +106,7 @@ void BattlegroundMgr::Update(uint32 diff)
|
|||||||
uint32 arenaRatedTeamId = scheduled[i] >> 32;
|
uint32 arenaRatedTeamId = scheduled[i] >> 32;
|
||||||
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundQueueTypeId(scheduled[i] >> 16 & 255);
|
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundQueueTypeId(scheduled[i] >> 16 & 255);
|
||||||
BattlegroundBracketId bracket_id = BattlegroundBracketId(scheduled[i] & 255);
|
BattlegroundBracketId bracket_id = BattlegroundBracketId(scheduled[i] & 255);
|
||||||
m_BattlegroundQueues[bgQueueTypeId].BattlegroundQueueUpdate(bracket_id, 0x03, true, arenaRatedTeamId); // pussywizard: looking for opponents only for this team
|
m_BattlegroundQueues[bgQueueTypeId].BattlegroundQueueUpdate(bracket_id, true, arenaRatedTeamId); // pussywizard: looking for opponents only for this team
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,14 +116,13 @@ void BattlegroundMgr::Update(uint32 diff)
|
|||||||
// for rated arenas
|
// for rated arenas
|
||||||
for (uint32 qtype = BATTLEGROUND_QUEUE_2v2; qtype < MAX_BATTLEGROUND_QUEUE_TYPES; ++qtype)
|
for (uint32 qtype = BATTLEGROUND_QUEUE_2v2; qtype < MAX_BATTLEGROUND_QUEUE_TYPES; ++qtype)
|
||||||
for (uint32 bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
|
for (uint32 bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
|
||||||
m_BattlegroundQueues[qtype].BattlegroundQueueUpdate(BattlegroundBracketId(bracket), 0x03, true, 0); // pussywizard: 0 for rated means looking for opponents for every team
|
m_BattlegroundQueues[qtype].BattlegroundQueueUpdate(BattlegroundBracketId(bracket), true, 0); // pussywizard: 0 for rated means looking for opponents for every team
|
||||||
|
|
||||||
// for battlegrounds and not rated arenas
|
// for battlegrounds and not rated arenas
|
||||||
// in first loop try to fill already running battlegrounds, then in a second loop try to create new battlegrounds
|
// in first loop try to fill already running battlegrounds, then in a second loop try to create new battlegrounds
|
||||||
for (uint8 action = 1; action <= 2; ++action)
|
|
||||||
for (uint32 qtype = BATTLEGROUND_QUEUE_AV; qtype < MAX_BATTLEGROUND_QUEUE_TYPES; ++qtype)
|
for (uint32 qtype = BATTLEGROUND_QUEUE_AV; qtype < MAX_BATTLEGROUND_QUEUE_TYPES; ++qtype)
|
||||||
for (uint32 bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
|
for (uint32 bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
|
||||||
m_BattlegroundQueues[qtype].BattlegroundQueueUpdate(BattlegroundBracketId(bracket), action, false, 0);
|
m_BattlegroundQueues[qtype].BattlegroundQueueUpdate(BattlegroundBracketId(bracket), false, 0);
|
||||||
|
|
||||||
m_NextPeriodicQueueUpdateTime = 5*IN_MILLISECONDS;
|
m_NextPeriodicQueueUpdateTime = 5*IN_MILLISECONDS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -670,7 +670,7 @@ void BattlegroundQueue::UpdateEvents(uint32 diff)
|
|||||||
struct BgEmptinessComp { bool operator()(Battleground* const& bg1, Battleground* const& bg2) const { return ((float)bg1->GetMaxFreeSlots() / (float)bg1->GetMaxPlayersPerTeam()) > ((float)bg2->GetMaxFreeSlots() / (float)bg2->GetMaxPlayersPerTeam()); } };
|
struct BgEmptinessComp { bool operator()(Battleground* const& bg1, Battleground* const& bg2) const { return ((float)bg1->GetMaxFreeSlots() / (float)bg1->GetMaxPlayersPerTeam()) > ((float)bg2->GetMaxFreeSlots() / (float)bg2->GetMaxPlayersPerTeam()); } };
|
||||||
typedef std::set<Battleground*, BgEmptinessComp> BattlegroundNeedSet;
|
typedef std::set<Battleground*, BgEmptinessComp> BattlegroundNeedSet;
|
||||||
|
|
||||||
void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id, uint8 actionMask, bool isRated, uint32 arenaRatedTeamId)
|
void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id, bool isRated, uint32 arenaRatedTeamId)
|
||||||
{
|
{
|
||||||
// if no players in queue - do nothing
|
// if no players in queue - do nothing
|
||||||
if (IsAllQueuesEmpty(bracket_id))
|
if (IsAllQueuesEmpty(bracket_id))
|
||||||
@@ -685,7 +685,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// battlegrounds with free slots should be populated first using players in queue
|
// battlegrounds with free slots should be populated first using players in queue
|
||||||
if ((actionMask & 0x01) && !BattlegroundMgr::IsArenaType(m_bgTypeId))
|
if (!BattlegroundMgr::IsArenaType(m_bgTypeId))
|
||||||
{
|
{
|
||||||
const BattlegroundContainer& bgList = sBattlegroundMgr->GetBattlegroundList();
|
const BattlegroundContainer& bgList = sBattlegroundMgr->GetBattlegroundList();
|
||||||
BattlegroundNeedSet bgsToCheck;
|
BattlegroundNeedSet bgsToCheck;
|
||||||
@@ -722,9 +722,6 @@ void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id
|
|||||||
|
|
||||||
// finished iterating through battlegrounds with free slots, maybe we need to create a new bg
|
// finished iterating through battlegrounds with free slots, maybe we need to create a new bg
|
||||||
|
|
||||||
if ((actionMask & 0x02) == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// get min and max players per team
|
// get min and max players per team
|
||||||
uint32 MinPlayersPerTeam = bg_template->GetMinPlayersPerTeam();
|
uint32 MinPlayersPerTeam = bg_template->GetMinPlayersPerTeam();
|
||||||
uint32 MaxPlayersPerTeam = bg_template->GetMaxPlayersPerTeam();
|
uint32 MaxPlayersPerTeam = bg_template->GetMaxPlayersPerTeam();
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class BattlegroundQueue
|
|||||||
BattlegroundQueue();
|
BattlegroundQueue();
|
||||||
~BattlegroundQueue();
|
~BattlegroundQueue();
|
||||||
|
|
||||||
void BattlegroundQueueUpdate(BattlegroundBracketId bracket_id, uint8 actionMask, bool isRated, uint32 arenaRatedTeamId);
|
void BattlegroundQueueUpdate(BattlegroundBracketId bracket_id, bool isRated, uint32 arenaRatedTeamId);
|
||||||
void UpdateEvents(uint32 diff);
|
void UpdateEvents(uint32 diff);
|
||||||
|
|
||||||
void FillPlayersToBG(Battleground* bg, const int32 aliFree, const int32 hordeFree, BattlegroundBracketId bracket_id);
|
void FillPlayersToBG(Battleground* bg, const int32 aliFree, const int32 hordeFree, BattlegroundBracketId bracket_id);
|
||||||
|
|||||||
Reference in New Issue
Block a user