diff --git a/src/backend/game/game.cpp b/src/backend/game/game.cpp index dd1012bb..030734ba 100644 --- a/src/backend/game/game.cpp +++ b/src/backend/game/game.cpp @@ -40,9 +40,9 @@ namespace fs = boost::filesystem; namespace lc = boost::locale; namespace loot { - Game::Game() {} + Game::Game() : _pluginsFullyLoaded(false) {} - Game::Game(const GameSettings& gameSettings) : GameSettings(gameSettings.Id(), gameSettings.FolderName()) { + Game::Game(const GameSettings& gameSettings) : GameSettings(gameSettings.Id(), gameSettings.FolderName()), _pluginsFullyLoaded(false) { this->SetName(gameSettings.Name()) .SetMaster(gameSettings.Master()) .SetRepoURL(gameSettings.RepoURL()) @@ -51,7 +51,7 @@ namespace loot { .SetRegistryKey(gameSettings.RegistryKey()); } - Game::Game(const unsigned int gameCode, const std::string& folder) : GameSettings(gameCode, folder) {} + Game::Game(const unsigned int gameCode, const std::string& folder) : GameSettings(gameCode, folder), _pluginsFullyLoaded(false) {} void Game::Init(bool createFolder, const boost::filesystem::path& gameLocalAppData) { if (Id() != Game::tes4 && Id() != Game::tes5 && Id() != Game::fo3 && Id() != Game::fonv) { @@ -183,17 +183,12 @@ namespace loot { if (thread.joinable()) thread.join(); } + + _pluginsFullyLoaded = !headersOnly; } - bool Game::HasBeenLoaded() { - // Easy way to check is by checking the game's master file, - // which definitely shouldn't be empty. - auto pairIt = plugins.find(boost::locale::to_lower(Master())); - - if (pairIt != plugins.end()) - return !pairIt->second.FormIDs().empty(); - - return false; + bool Game::ArePluginsFullyLoaded() const { + return _pluginsFullyLoaded; } std::list ToGames(const std::list& settings) { diff --git a/src/backend/game/game.h b/src/backend/game/game.h index d2cd6bf5..d3ec731d 100644 --- a/src/backend/game/game.h +++ b/src/backend/game/game.h @@ -57,7 +57,7 @@ namespace loot { void RedatePlugins(); //Change timestamps to match load order (Skyrim only). void LoadPlugins(bool headersOnly); //Loads all installed plugins. - bool HasBeenLoaded(); // Checks if the game's plugins have already been loaded. + bool ArePluginsFullyLoaded() const; // Checks if the game's plugins have already been loaded. //Caches for condition results, active plugins and CRCs. std::unordered_map conditionCache; //Holds lowercased strings. @@ -68,6 +68,8 @@ namespace loot { Masterlist masterlist; MetadataList userlist; std::unordered_map plugins; //Map so that plugin data can be edited. + private: + bool _pluginsFullyLoaded; }; std::list ToGames(const std::list& settings); diff --git a/src/gui/handler.cpp b/src/gui/handler.cpp index 0fbe8490..a1ecde06 100644 --- a/src/gui/handler.cpp +++ b/src/gui/handler.cpp @@ -383,7 +383,7 @@ namespace loot { // Checking for FormID overlap will only work if the plugins have been loaded, so check if // the plugins have been fully loaded, and if not load all plugins. - if (!_lootState.CurrentGame().HasBeenLoaded()) { + if (!_lootState.CurrentGame().ArePluginsFullyLoaded()) { SendProgressUpdate(frame, loc::translate("Loading plugin contents...")); _lootState.CurrentGame().LoadPlugins(false); }