mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Fix spellbook tabs race condition with DBC lazy loading
lookupSpellName() (called by action bar tooltips) was triggering loadSpellDBC() early, setting dbcLoadAttempted=true before the spellbook opened. This caused loadSkillLineDBCs() to be skipped, so all spells were categorized into "General". Fixed by checking each DBC's own loaded flag independently and re-categorizing when skill line data becomes available.
This commit is contained in:
parent
c919477e74
commit
c2b271df6f
2 changed files with 9 additions and 2 deletions
|
|
@ -71,6 +71,7 @@ private:
|
|||
// Categorized spell tabs
|
||||
std::vector<SpellTabInfo> spellTabs;
|
||||
size_t lastKnownSpellCount = 0;
|
||||
bool categorizedWithSkillLines = false;
|
||||
|
||||
// Search filter
|
||||
char searchFilter_[128] = "";
|
||||
|
|
|
|||
|
|
@ -300,6 +300,7 @@ void SpellbookScreen::categorizeSpells(const std::unordered_set<uint32_t>& known
|
|||
}
|
||||
|
||||
lastKnownSpellCount = knownSpells.size();
|
||||
categorizedWithSkillLines = !spellToSkillLine.empty();
|
||||
}
|
||||
|
||||
VkDescriptorSet SpellbookScreen::getSpellIcon(uint32_t iconId, pipeline::AssetManager* assetManager) {
|
||||
|
|
@ -399,13 +400,18 @@ void SpellbookScreen::render(game::GameHandler& gameHandler, pipeline::AssetMana
|
|||
// Lazy-load DBC data on first open
|
||||
if (!dbcLoadAttempted) {
|
||||
loadSpellDBC(assetManager);
|
||||
}
|
||||
if (!iconDbLoaded) {
|
||||
loadSpellIconDBC(assetManager);
|
||||
}
|
||||
if (!skillLineDbLoaded) {
|
||||
loadSkillLineDBCs(assetManager);
|
||||
}
|
||||
|
||||
// Rebuild categories if spell list changed
|
||||
// Rebuild categories if spell list changed or skill line data became available
|
||||
const auto& spells = gameHandler.getKnownSpells();
|
||||
if (spells.size() != lastKnownSpellCount) {
|
||||
bool skillLinesNowAvailable = !spellToSkillLine.empty() && !categorizedWithSkillLines;
|
||||
if (spells.size() != lastKnownSpellCount || skillLinesNowAvailable) {
|
||||
categorizeSpells(spells);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue