mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-07-28 18:47:40 +00:00
fix(Core/Battlegrounds): fill existing BGs instead of starting duplicates (#26585)
This commit is contained in:
@@ -948,7 +948,7 @@ BGFreeSlotQueueContainer& BattlegroundMgr::GetBGFreeSlotQueueStore(BattlegroundT
|
||||
|
||||
void BattlegroundMgr::AddToBGFreeSlotQueue(BattlegroundTypeId bgTypeId, Battleground* bg)
|
||||
{
|
||||
bgDataStore[bgTypeId].BGFreeSlotQueue.push_front(bg);
|
||||
bgDataStore[bgTypeId].BGFreeSlotQueue.push_back(bg);
|
||||
}
|
||||
|
||||
void BattlegroundMgr::RemoveFromBGFreeSlotQueue(BattlegroundTypeId bgTypeId, uint32 instanceId)
|
||||
|
||||
@@ -805,8 +805,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundTypeId
|
||||
}
|
||||
};
|
||||
|
||||
// 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 bracket_id
|
||||
// fill existing joinable battlegrounds, oldest first, before a new instance may form below
|
||||
BGFreeSlotQueueContainer& bgQueues = sBattlegroundMgr->GetBGFreeSlotQueueStore(bgTypeId);
|
||||
for (BGFreeSlotQueueContainer::iterator itr = bgQueues.begin(); itr != bgQueues.end();)
|
||||
{
|
||||
|
||||
@@ -554,6 +554,8 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recvData)
|
||||
// leaks forever, permanently skewing team selection and blocking the
|
||||
// empty instance's cleanup.
|
||||
bg->DecreaseInvitedCount(teamId);
|
||||
if (bg->HasFreeSlots())
|
||||
bg->AddToBGFreeSlotQueue();
|
||||
_player->RemoveBattlegroundQueueId(bgQueueTypeId);
|
||||
_player->SetBattlegroundId(0, BATTLEGROUND_TYPE_NONE, PLAYER_MAX_BATTLEGROUND_QUEUES, false, false, TEAM_NEUTRAL);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user