diff --git a/include/game/game_handler.hpp b/include/game/game_handler.hpp index 53e7574e..292206fc 100644 --- a/include/game/game_handler.hpp +++ b/include/game/game_handler.hpp @@ -1275,6 +1275,7 @@ public: bool isLfgInDungeon() const { return lfgState_ == LfgState::InDungeon; } uint32_t getLfgDungeonId() const { return lfgDungeonId_; } std::string getCurrentLfgDungeonName() const { return getLfgDungeonName(lfgDungeonId_); } + std::string getMapName(uint32_t mapId) const; uint32_t getLfgProposalId() const { return lfgProposalId_; } int32_t getLfgAvgWaitSec() const { return lfgAvgWaitSec_; } uint32_t getLfgTimeInQueueMs() const { return lfgTimeInQueueMs_; } @@ -2977,7 +2978,6 @@ private: std::unordered_map mapNameCache_; bool mapNameCacheLoaded_ = false; void loadMapNameCache(); - std::string getMapName(uint32_t mapId) const; // LFG dungeon name cache (lazy-loaded from LFGDungeons.dbc; WotLK only) std::unordered_map lfgDungeonNameCache_; diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index 73297138..feb6efe9 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -19555,24 +19555,6 @@ void GameScreen::renderInstanceLockouts(game::GameHandler& gameHandler) { if (lockouts.empty()) { ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1.0f), "No active instance lockouts."); } else { - // Build map name lookup from Map.dbc (cached after first call) - static std::unordered_map sMapNames; - static bool sMapNamesLoaded = false; - if (!sMapNamesLoaded) { - sMapNamesLoaded = true; - if (auto* am = core::Application::getInstance().getAssetManager()) { - if (auto dbc = am->loadDBC("Map.dbc"); dbc && dbc->isLoaded()) { - for (uint32_t i = 0; i < dbc->getRecordCount(); ++i) { - uint32_t id = dbc->getUInt32(i, 0); - // Field 2 = MapName_enUS (first localized), field 1 = InternalName - std::string name = dbc->getString(i, 2); - if (name.empty()) name = dbc->getString(i, 1); - if (!name.empty()) sMapNames[id] = std::move(name); - } - } - } - } - auto difficultyLabel = [](uint32_t diff) -> const char* { switch (diff) { case 0: return "Normal"; @@ -19598,11 +19580,11 @@ void GameScreen::renderInstanceLockouts(game::GameHandler& gameHandler) { for (const auto& lo : lockouts) { ImGui::TableNextRow(); - // Instance name + // Instance name — use GameHandler's Map.dbc cache (avoids duplicate DBC load) ImGui::TableSetColumnIndex(0); - auto it = sMapNames.find(lo.mapId); - if (it != sMapNames.end()) { - ImGui::TextUnformatted(it->second.c_str()); + std::string mapName = gameHandler.getMapName(lo.mapId); + if (!mapName.empty()) { + ImGui::TextUnformatted(mapName.c_str()); } else { ImGui::Text("Map %u", lo.mapId); }