diff options
| author | Mikaƫl Capelle <capelle.mikael@gmail.com> | 2024-06-09 12:18:17 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-09 12:18:17 +0200 |
| commit | 88c386d74d7d94ec16d4d84ed674eb51e31647ac (patch) | |
| tree | adf0b2537f12d11d8df77f68a84926d15b063554 /src/directoryrefresher.cpp | |
| parent | c43535f5bcf1043c3b9c00c77967267cf1acf60f (diff) | |
Refactoring of game features for better management. (#2043)
Diffstat (limited to 'src/directoryrefresher.cpp')
| -rw-r--r-- | src/directoryrefresher.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/directoryrefresher.cpp b/src/directoryrefresher.cpp index 3313b8c5..e2e05b2c 100644 --- a/src/directoryrefresher.cpp +++ b/src/directoryrefresher.cpp @@ -22,9 +22,11 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "shared/filesorigin.h" #include "envfs.h" +#include "game_features.h" #include "iplugingame.h" #include "modinfo.h" #include "modinfodialogfwd.h" +#include "organizercore.h" #include "report.h" #include "settings.h" #include "shared/util.h" @@ -159,8 +161,8 @@ void dumpStats(std::vector<DirectoryStats>& stats) ++run; } -DirectoryRefresher::DirectoryRefresher(std::size_t threadCount) - : m_threadCount(threadCount), m_lastFileCount(0) +DirectoryRefresher::DirectoryRefresher(OrganizerCore* core, std::size_t threadCount) + : m_Core(*core), m_threadCount(threadCount), m_lastFileCount(0) {} DirectoryEntry* DirectoryRefresher::stealDirectoryStructure() @@ -204,11 +206,9 @@ void DirectoryRefresher::addModBSAToStructure(DirectoryEntry* root, const QString& directory, const QStringList& archives) { - const IPluginGame* game = qApp->property("managed_game").value<IPluginGame*>(); - QStringList loadOrder; - GamePlugins* gamePlugins = game->feature<GamePlugins>(); + auto gamePlugins = m_Core.gameFeatures().gameFeature<GamePlugins>(); if (gamePlugins) { loadOrder = gamePlugins->getLoadOrder(); } @@ -320,6 +320,7 @@ void DirectoryRefresher::addModToStructure(DirectoryEntry* directoryStructure, struct ModThread { + GameFeatures* gameFeatures; DirectoryRefreshProgress* progress = nullptr; DirectoryEntry* ds = nullptr; std::wstring modName; @@ -355,10 +356,8 @@ struct ModThread ds->addFromOrigin(walker, modName, path, prio, *stats); if (Settings::instance().archiveParsing()) { - const IPluginGame* game = qApp->property("managed_game").value<IPluginGame*>(); - QStringList loadOrder; - GamePlugins* gamePlugins = game->feature<GamePlugins>(); + auto gamePlugins = gameFeatures->gameFeature<GamePlugins>(); if (gamePlugins) { loadOrder = gamePlugins->getLoadOrder(); } @@ -420,11 +419,12 @@ void DirectoryRefresher::addMultipleModsFilesToStructure( } else { auto& mt = g_threads.request(); - mt.progress = progress; - mt.ds = directoryStructure; - mt.modName = e.modName.toStdWString(); - mt.path = QDir::toNativeSeparators(e.absolutePath).toStdWString(); - mt.prio = prio; + mt.gameFeatures = &m_Core.gameFeatures(); + mt.progress = progress; + mt.ds = directoryStructure; + mt.modName = e.modName.toStdWString(); + mt.path = QDir::toNativeSeparators(e.absolutePath).toStdWString(); + mt.prio = prio; mt.archives.clear(); for (auto&& a : e.archives) { |
