Skip to content

fix(WG): bind SkipClasses config to a local before Tokenize#170

Merged
Nyeriah merged 1 commit into
azerothcore:masterfrom
Nyeriah:feat/cfbg-wg-skip-classes
Jun 22, 2026
Merged

fix(WG): bind SkipClasses config to a local before Tokenize#170
Nyeriah merged 1 commit into
azerothcore:masterfrom
Nyeriah:feat/cfbg-wg-skip-classes

Conversation

@Nyeriah

@Nyeriah Nyeriah commented Jun 22, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up build fix for #169 (CFBG.Battlefield.SkipClasses).

LoadConfig passes the temporary std::string returned by GetOption directly into Acore::Tokenize. Since Tokenize returns std::string_views that point into its argument, its rvalue overloads are deleted, so this fails to compile against a core that has the deleted overloads:

fatal error: call to deleted function 'Tokenize'
    for (auto const& token : Acore::Tokenize(sConfigMgr->GetOption<std::string>("CFBG.Battlefield.SkipClasses", ""), ',', false))

Fix: store the option in a named local first, so the views stay valid for the duration of the loop.

Testing

  • Compiles clean with the fix applied.
  • No behaviour change: the parsed set and default (empty) are identical.

Summary by CodeRabbit

Release Notes

No user-facing changes in this release. Internal code maintenance and optimization have been applied to improve code reliability and maintainability.

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2f26ccf9-4355-4473-adb1-4b0a87c3fa26

📥 Commits

Reviewing files that changed from the base of the PR and between 3a5c2b1 and c5c97aa.

📒 Files selected for processing (1)
  • src/CFBG.cpp

📝 Walkthrough

Walkthrough

In CFBG::LoadConfig(), the CFBG.Battlefield.SkipClasses config value is now read into a local std::string const skipClasses variable before being passed to the tokenizer, replacing the previous inline expression.

Changes

SkipClasses Config Refactor

Layer / File(s) Summary
LoadConfig SkipClasses tokenization refactor
src/CFBG.cpp
Stores the GetStringDefault("CFBG.Battlefield.SkipClasses", "") result in a local skipClasses variable before tokenizing by commas, instead of tokenizing the call expression inline.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A bunny hopped through lines of code,
And found a string along the road.
"Why inline what can be named?"
Said she, and stored it, neatly framed.
Now skipClasses stands alone — how neat! 🐇

🚥 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 captures the main feature: adding CFBG.Battlefield.SkipClasses configuration to prevent specific classes from being reassigned in Wintergrasp.
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 unit tests (beta)
  • Create PR with unit tests

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

Acore::Tokenize returns string_views into its argument and deletes its
rvalue overloads, so passing GetOption's temporary std::string directly
fails to compile. Store it in a named local so the views stay valid.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Nyeriah Nyeriah force-pushed the feat/cfbg-wg-skip-classes branch from 3a5c2b1 to c5c97aa Compare June 22, 2026 08:10
@Nyeriah Nyeriah changed the title feat(WG): add CFBG.Battlefield.SkipClasses to keep classes native fix(WG): bind SkipClasses config to a local before Tokenize Jun 22, 2026
@Nyeriah Nyeriah merged commit 902f3af into azerothcore:master Jun 22, 2026
1 check was pending
@Nyeriah Nyeriah deleted the feat/cfbg-wg-skip-classes branch June 22, 2026 08:11
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.

1 participant