Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Battleground: Fix players unable to join running battleground or too … #593

Merged
merged 1 commit into from
Jan 21, 2025

Conversation

mostlikely4r
Copy link
Contributor

…many players being able to join

🍰 Pullrequest

This pull request fixes two issues with battleground queues.

  1. Players are able to join a battleground that is in progress but that is full.
  2. Players are unable to join a battleground that is in progress but where there is room to join.

Proof

When a battleground is created for a premade group (and for non-premades simulary) the BattleGroundInQueueInfo is saved to the BattleGroundQueue here:

queue.AddBgToFreeSlots(bgInfo);

Notice that his is an emplace_back which copies the BattleGroundInQueueInfo so it can later be used to check the room for new invites. However only after the copy it fills the invited counts here:

InviteGroupToBg((*citr), bgInfo, (*citr)->groupTeam);

Since the original bgInfo goes out of scope after this method the information is lost.

This leaves the invited players at 0/0 globally in the BattleGroundInQueueInfo while the battleground has the correct values. If a player removes the battleground it will actually make these values negative which makes it a huge number and this block any invites.

The second issue was actually a bit nastier. This is actually a copy:

auto queueItems = queue.GetFreeSlotQueueItem(bgTypeId);

The auto hides it a bit but if you create a custom destructor for BattleGroundInQueueInfo you see the queueInfo created from it go out of scope at the end of this code.

The result is that even with above fix new players joining a bg in progress are not saved to the global BattleGroundInQueueInfo resulting in the ability to join a filled battleground.

Issues

  • None found.

How2Test

  • I used 21 clients to properly fill a wsg + 1. While 10 clients (5/5) are enough to test the initial issue of players being unable to join a bg in progress after 1 player leaves. The second issue of joining a completely filled wsg need (probably) at least 16 clients (5 horde/11 alliance) or active debugging to check the values of BattleGroundInQueueInfo.
    -The expected results are that a battleground that is not completely filled should be joinable after one of the players leaves it and that a completely filled battleground should not be joinable.

// 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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the move of this code tidbit

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because InviteGroupToBg modifies the invited values of bgInfo. If we copy bgInfo to the global queue object before these values are set they will be copied empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind AddBgToFreeSlots does a copy instead of a move (if that is even possible).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants