diff --git a/include/ui/spellbook_screen.hpp b/include/ui/spellbook_screen.hpp index 7a083183..a6944972 100644 --- a/include/ui/spellbook_screen.hpp +++ b/include/ui/spellbook_screen.hpp @@ -71,6 +71,7 @@ private: // Categorized spell tabs std::vector spellTabs; size_t lastKnownSpellCount = 0; + bool categorizedWithSkillLines = false; // Search filter char searchFilter_[128] = ""; diff --git a/src/ui/spellbook_screen.cpp b/src/ui/spellbook_screen.cpp index 73aa45b0..6e857d73 100644 --- a/src/ui/spellbook_screen.cpp +++ b/src/ui/spellbook_screen.cpp @@ -300,6 +300,7 @@ void SpellbookScreen::categorizeSpells(const std::unordered_set& 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); }