fix(Core/Battlegrounds): fill existing BGs instead of starting duplicates (#26585)

This commit is contained in:
Francesco Borzì
2026-07-15 02:20:43 +02:00
committed by GitHub
parent 586775375a
commit 142b2ba67c
3 changed files with 4 additions and 3 deletions

View File

@@ -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)

View File

@@ -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();)
{

View File

@@ -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);