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 54629be commit 6396054
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/game/BattleGround/BattleGroundQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,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 @@ -968,8 +968,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 @@ -979,6 +977,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 @@ -1012,13 +1012,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 Expand Up @@ -1149,8 +1149,6 @@ void BattleGroundQueueItem::Update(BattleGroundQueue& queue, BattleGroundTypeId
bgInfo.isRated = true;
bgInfo.arenaType = arenaType;

queue.AddBgToFreeSlots(bgInfo);

GroupQueueInfo* firstGroup = *(itr_team[TEAM_INDEX_ALLIANCE]);
GroupQueueInfo* secondGroup = *(itr_team[TEAM_INDEX_HORDE]);

Expand Down Expand Up @@ -1179,6 +1177,8 @@ void BattleGroundQueueItem::Update(BattleGroundQueue& queue, BattleGroundTypeId
InviteGroupToBg(firstGroup, bgInfo, ALLIANCE);
InviteGroupToBg(secondGroup, bgInfo, HORDE);

queue.AddBgToFreeSlots(bgInfo);

DEBUG_LOG("Starting rated arena match!");

sWorld.GetMessager().AddMessage([instanceId = bgInfo.instanceId, clientInstanceId = bgInfo.m_clientInstanceId, arenaType, bgTypeId, bracketId, allianceCount = bgInfo.GetInvitedCount(ALLIANCE), hordeCount = bgInfo.GetInvitedCount(HORDE), firstTeam = firstGroup->groupTeam, firstTeamId = firstGroup->arenaTeamId, secondTeam = secondGroup->groupTeam, secondTeamId = secondGroup->arenaTeamId](World* /*world*/)
Expand Down

0 comments on commit 6396054

Please sign in to comment.