Repository navigation
Conversation
… map AddPlayer() inserted the player into m_Players and then asked IsPlayerInBattleGround(), which looks the player up in that same map, so it always returned true and the team counts never increased. With BattleGround.PrematureFinishTimer set, every battleground then ended with a premature finish once the timer ran out after the start.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the battleground team-counting change.
No open issues 🎉
What changed in this PR
Fixes battleground team counting by checking player membership before inserting the player into m_Players. This addresses the regression from #165 while preserving its protection against double-counting players who re-log.
Changes:
- Moves the membership check before map insertion so new arrivals increment team counts.
- Adds a comment explaining why re-logging players are already counted.
| File | Description |
|---|---|
src/game/BattleGround/BattleGround.cpp |
Corrects membership-check ordering in BattleGround::AddPlayer to restore team counts and prevent erroneous premature finishes. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BattleGround::AddPlayerinserted the player intom_Playersand only then askedIsPlayerInBattleGround(guid), which looks the player up in that same map. The check therefore always returned true and the team counts never increased (regression from #165).With the default
BattleGround.PrematureFinishTimer = 300000, the premature-finish check then saw fewer than the minimum players on both teams, and every battleground ended by premature finish five minutes after the start. A player leaving also decremented theuint32count from zero.IsPlayerInBattleGroundbefore adding the player tom_Players, so a player re-logging into the battleground is still counted only once, as Fixed Player Count Bug Battlegrounds #165 intendedVerification
mangosdin Release and RelWithDebInfoNo database, configuration, or submodule changes are included.
This change is