Skip to content

Commit

Permalink
Battleground: Fix players unable to join running battleground or too …
Browse files Browse the repository at this point in the history
…many players being able to join
  • Loading branch information
mostlikely4r authored and killerwife committed Jan 21, 2025
1 parent f0fab6b commit 5c9e15b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/game/BattleGround/BattleGroundQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ void BattleGroundQueueItem::Update(BattleGroundQueue& queue, 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
BgFreeSlotQueueType::iterator next;
auto queueItems = queue.GetFreeSlotQueueItem(bgTypeId);
auto& queueItems = queue.GetFreeSlotQueueItem(bgTypeId);
for (BgFreeSlotQueueType::iterator itr = queueItems.begin(); itr != queueItems.end(); itr = next)
{
BattleGroundInQueueInfo& queueInfo = *itr;
Expand Down Expand Up @@ -861,8 +861,6 @@ void BattleGroundQueueItem::Update(BattleGroundQueue& queue, BattleGroundTypeId
bgInfo.instanceId = sMapMgr.GenerateInstanceId();
bgInfo.m_clientInstanceId = queue.CreateClientVisibleInstanceId(bgTypeId, bracketId);

queue.AddBgToFreeSlots(bgInfo);

// invite those selection pools
for (uint8 i = 0; i < PVP_TEAM_COUNT; ++i)
for (GroupsQueueType::const_iterator citr = m_selectionPools[TEAM_INDEX_ALLIANCE + i].selectedGroups.begin(); citr != m_selectionPools[TEAM_INDEX_ALLIANCE + i].selectedGroups.end(); ++citr)
Expand All @@ -872,6 +870,8 @@ void BattleGroundQueueItem::Update(BattleGroundQueue& queue, BattleGroundTypeId
m_selectionPools[TEAM_INDEX_ALLIANCE].Init();
m_selectionPools[TEAM_INDEX_HORDE].Init();

queue.AddBgToFreeSlots(bgInfo);

sWorld.GetMessager().AddMessage([instanceId = bgInfo.instanceId, clientInstanceId = bgInfo.m_clientInstanceId, bgTypeId, bracketId, allianceCount = bgInfo.GetInvitedCount(ALLIANCE), hordeCount = bgInfo.GetInvitedCount(HORDE)](World* world)
{
// create new battleground
Expand Down Expand Up @@ -901,13 +901,13 @@ void BattleGroundQueueItem::Update(BattleGroundQueue& queue, BattleGroundTypeId
bgInfo.instanceId = sMapMgr.GenerateInstanceId();
bgInfo.m_clientInstanceId = queue.CreateClientVisibleInstanceId(bgTypeId, bracketId);

queue.AddBgToFreeSlots(bgInfo);

// invite those selection pools
for (uint8 i = 0; i < PVP_TEAM_COUNT; ++i)
for (GroupsQueueType::const_iterator citr = m_selectionPools[TEAM_INDEX_ALLIANCE + i].selectedGroups.begin(); citr != m_selectionPools[TEAM_INDEX_ALLIANCE + i].selectedGroups.end(); ++citr)
InviteGroupToBg((*citr), bgInfo, (*citr)->groupTeam);

queue.AddBgToFreeSlots(bgInfo);

sWorld.GetMessager().AddMessage([instanceId = bgInfo.instanceId, clientInstanceId = bgInfo.m_clientInstanceId, bgTypeId, bracketId, allianceCount = bgInfo.GetInvitedCount(ALLIANCE), hordeCount = bgInfo.GetInvitedCount(HORDE)](World* world)
{
// create new battleground
Expand Down

0 comments on commit 5c9e15b

Please sign in to comment.