mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-03 20:03:50 +00:00
fix: static lastSpellCount shared across SpellHandler instances
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
The spellbook tab dirty check used a function-local static, meaning switching to a character with the same spell count would skip the rebuild and return the previous character's tabs. Changed to an instance member so each SpellHandler tracks its own count.
This commit is contained in:
parent
e629898bfb
commit
bf63d8e385
2 changed files with 6 additions and 3 deletions
|
|
@ -307,6 +307,7 @@ private:
|
|||
|
||||
// Spell book tabs
|
||||
std::vector<SpellBookTab> spellBookTabs_;
|
||||
size_t lastSpellCount_ = 0;
|
||||
bool spellBookTabsDirty_ = true;
|
||||
|
||||
// Talent wipe confirm dialog
|
||||
|
|
|
|||
|
|
@ -547,10 +547,12 @@ void SpellHandler::useItemById(uint32_t itemId) {
|
|||
}
|
||||
|
||||
const std::vector<SpellHandler::SpellBookTab>& SpellHandler::getSpellBookTabs() {
|
||||
static size_t lastSpellCount = 0;
|
||||
if (lastSpellCount == knownSpells_.size() && !spellBookTabsDirty_)
|
||||
// Must be an instance member, not static — a static is shared across all
|
||||
// SpellHandler instances, so switching characters with the same spell count
|
||||
// would skip the rebuild and return the previous character's tabs.
|
||||
if (lastSpellCount_ == knownSpells_.size() && !spellBookTabsDirty_)
|
||||
return spellBookTabs_;
|
||||
lastSpellCount = knownSpells_.size();
|
||||
lastSpellCount_ = knownSpells_.size();
|
||||
spellBookTabsDirty_ = false;
|
||||
spellBookTabs_.clear();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue