Skip to content

fix: enforce assigned-team consistency in BGs - #168

Merged
Nyeriah merged 1 commit into
masterfrom
fix-166
Jun 22, 2026
Merged

fix: enforce assigned-team consistency in BGs#168
Nyeriah merged 1 commit into
masterfrom
fix-166

Conversation

@FrancescoBorzi

@FrancescoBorzi FrancescoBorzi commented Jun 16, 2026

Copy link
Copy Markdown

Summary by CodeRabbit

  • Bug Fixes
    • Improved team assignment consistency for players in cross-faction battlegrounds.
    • Fixed team state restoration when players are resurrected during battleground matches.
    • Enhanced faction-specific standing updates for Alterac Valley cross-faction scenarios.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7529b3ba-806c-449f-831d-dd2aa928f0dd

📥 Commits

Reviewing files that changed from the base of the PR and between 702df19 and 20e37c8.

📒 Files selected for processing (3)
  • src/CFBG.cpp
  • src/CFBG.h
  • src/CFBG_SC.cpp

📝 Walkthrough

Walkthrough

Adds a new EnforceBGTeamConsistency(Player*) method to CFBG that idempotently reconciles a player's fake race/faction/team state against their assigned BG team. ValidatePlayerForBG is refactored to write bgTeamId authoritatively and delegate all fake/native alignment to this helper, with AV forced-reaction logic restricted to cross-faction players. OnPlayerResurrect gains a dedicated BG branch that calls the same helper before any WG logic.

Changes

BG Team Consistency Enforcement

Layer / File(s) Summary
EnforceBGTeamConsistency declaration and ValidatePlayerForBG refactor
src/CFBG.h, src/CFBG.cpp
Declares EnforceBGTeamConsistency publicly in CFBG, implements the method with three reconciliation paths (clear fake for native, set/redo fake for new cross-faction, re-apply for already-correct cross-faction), and updates ValidatePlayerForBG to treat GetBgTeamId() as authoritative and gate AV reaction logic on cross-faction players only.
OnPlayerResurrect BG path
src/CFBG_SC.cpp
Adds an early BG branch in OnPlayerResurrect that calls EnforceBGTeamConsistency and returns, leaving the existing WG IsEnableWGReapplyOnResurrect check for non-BG players.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 Hop, hop — the teams align at last,
No stale fakes lurking from the past!
Frostwolf or Stormpike, the method decides,
Idempotent logic where consistency resides.
Every resurrect, every validate call —
One helper to reconcile them all! 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: enforcing that players' team state matches their assigned battleground team across the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-166

Comment @coderabbitai help to get the list of available commands and usage tips.

@PkllonG

PkllonG commented Jun 17, 2026

Copy link
Copy Markdown

Tested

@Nyeriah
Nyeriah merged commit 9da4cf6 into master Jun 22, 2026
2 checks passed
@Nyeriah
Nyeriah deleted the fix-166 branch June 22, 2026 07:40
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.

3 participants