diff options
Diffstat (limited to 'src/directoryrefresher.cpp')
| -rw-r--r-- | src/directoryrefresher.cpp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/directoryrefresher.cpp b/src/directoryrefresher.cpp index e2e05b2c..9afbfca8 100644 --- a/src/directoryrefresher.cpp +++ b/src/directoryrefresher.cpp @@ -328,7 +328,8 @@ struct ModThread int prio = -1; std::vector<std::wstring> archives; std::set<std::wstring> enabledArchives; - DirectoryStats* stats = nullptr; + std::vector<std::wstring>* loadOrder = nullptr; + DirectoryStats* stats = nullptr; env::DirectoryWalker walker; std::condition_variable cv; @@ -356,18 +357,8 @@ struct ModThread ds->addFromOrigin(walker, modName, path, prio, *stats); if (Settings::instance().archiveParsing()) { - QStringList loadOrder; - auto gamePlugins = gameFeatures->gameFeature<GamePlugins>(); - if (gamePlugins) { - loadOrder = gamePlugins->getLoadOrder(); - } - - std::vector<std::wstring> lo; - for (auto&& s : loadOrder) { - lo.push_back(s.toStdWString()); - } - - ds->addFromAllBSAs(modName, path, prio, archives, enabledArchives, lo, *stats); + ds->addFromAllBSAs(modName, path, prio, archives, enabledArchives, *loadOrder, + *stats); } if (progress) { @@ -400,6 +391,18 @@ void DirectoryRefresher::addMultipleModsFilesToStructure( log::debug("refresher: using {} threads", m_threadCount); g_threads.setMax(m_threadCount); + std::vector<std::wstring> loadOrder; + if (Settings::instance().archiveParsing()) { + auto gamePlugins = m_Core.gameFeatures().gameFeature<GamePlugins>(); + if (gamePlugins) { + QStringList lo = gamePlugins->getLoadOrder(); + loadOrder.reserve(lo.size()); + for (auto&& s : lo) { + loadOrder.push_back(s.toStdWString()); + } + } + } + for (std::size_t i = 0; i < entries.size(); ++i) { const auto& e = entries[i]; const int prio = e.priority + 1; @@ -436,7 +439,8 @@ void DirectoryRefresher::addMultipleModsFilesToStructure( mt.enabledArchives.insert(a.toStdWString()); } - mt.stats = &stats[i]; + mt.loadOrder = &loadOrder; + mt.stats = &stats[i]; mt.wakeup(); } |
