From 6366fed15c013fad135f2fb129f38b27181dc279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Sun, 9 Jun 2024 12:31:42 +0200 Subject: [PATCH] Refactoring following uibase change for game features. (#32) --- src/falloutnvbsainvalidation.cpp | 2 +- src/falloutnvbsainvalidation.h | 3 ++- src/falloutnvdataarchives.cpp | 2 +- src/falloutnvmoddatacontent.h | 4 ++-- src/game_falloutNV_en.ts | 6 ++--- src/gamefalloutnv.cpp | 40 ++++++++++++++++++-------------- 6 files changed, 32 insertions(+), 25 deletions(-) diff --git a/src/falloutnvbsainvalidation.cpp b/src/falloutnvbsainvalidation.cpp index 5436957..d66591f 100644 --- a/src/falloutnvbsainvalidation.cpp +++ b/src/falloutnvbsainvalidation.cpp @@ -1,6 +1,6 @@ #include "falloutnvbsainvalidation.h" -FalloutNVBSAInvalidation::FalloutNVBSAInvalidation(DataArchives* dataArchives, +FalloutNVBSAInvalidation::FalloutNVBSAInvalidation(MOBase::DataArchives* dataArchives, MOBase::IPluginGame const* game) : GamebryoBSAInvalidation(dataArchives, "fallout.ini", game) {} diff --git a/src/falloutnvbsainvalidation.h b/src/falloutnvbsainvalidation.h index e0ede07..2301acf 100644 --- a/src/falloutnvbsainvalidation.h +++ b/src/falloutnvbsainvalidation.h @@ -9,7 +9,8 @@ class FalloutNVBSAInvalidation : public GamebryoBSAInvalidation { public: - FalloutNVBSAInvalidation(DataArchives* dataArchives, MOBase::IPluginGame const* game); + FalloutNVBSAInvalidation(MOBase::DataArchives* dataArchives, + MOBase::IPluginGame const* game); private: virtual QString invalidationBSAName() const override; diff --git a/src/falloutnvdataarchives.cpp b/src/falloutnvdataarchives.cpp index d0cf873..b9f8359 100644 --- a/src/falloutnvdataarchives.cpp +++ b/src/falloutnvdataarchives.cpp @@ -33,4 +33,4 @@ void FalloutNVDataArchives::writeArchiveList(MOBase::IProfile* profile, ? QDir(profile->absolutePath()).absoluteFilePath("fallout.ini") : m_LocalGameDir.absoluteFilePath("fallout.ini"); setArchivesToKey(iniFile, "SArchiveList", list); -} \ No newline at end of file +} diff --git a/src/falloutnvmoddatacontent.h b/src/falloutnvmoddatacontent.h index 44a2a25..4effd97 100644 --- a/src/falloutnvmoddatacontent.h +++ b/src/falloutnvmoddatacontent.h @@ -10,8 +10,8 @@ class FalloutNVModDataContent : public GamebryoModDataContent /** * */ - FalloutNVModDataContent(GameGamebryo const* gamePlugin) - : GamebryoModDataContent(gamePlugin) + FalloutNVModDataContent(MOBase::IGameFeatures const* gameFeatures) + : GamebryoModDataContent(gameFeatures) { // Just need to disable some contents: m_Enabled[CONTENT_MCM] = false; diff --git a/src/game_falloutNV_en.ts b/src/game_falloutNV_en.ts index 589af61..00dc698 100644 --- a/src/game_falloutNV_en.ts +++ b/src/game_falloutNV_en.ts @@ -4,17 +4,17 @@ GameFalloutNV - + Fallout NV Support Plugin - + Adds support for the game Fallout New Vegas - + While not recommended by the FNV modding community, enables LOOT sorting diff --git a/src/gamefalloutnv.cpp b/src/gamefalloutnv.cpp index e5b64b8..9abba54 100644 --- a/src/gamefalloutnv.cpp +++ b/src/gamefalloutnv.cpp @@ -34,17 +34,20 @@ bool GameFalloutNV::init(IOrganizer* moInfo) if (!GameGamebryo::init(moInfo)) { return false; } - registerFeature(new FalloutNVScriptExtender(this)); - registerFeature(new FalloutNVDataArchives(myGamesPath())); - registerFeature( - new FalloutNVBSAInvalidation(feature(), this)); - registerFeature(new GamebryoSaveGameInfo(this)); - registerFeature( - new GamebryoLocalSavegames(myGamesPath(), "fallout.ini")); - registerFeature(new FalloutNVModDataChecker(this)); - registerFeature(new FalloutNVModDataContent(this)); - registerFeature(new GamebryoGamePlugins(moInfo)); - registerFeature(new GamebryoUnmangedMods(this)); + + auto dataArchives = std::make_shared(myGamesPath()); + registerFeature(std::make_shared(this)); + registerFeature(dataArchives); + registerFeature(std::make_shared(dataArchives.get(), this)); + registerFeature(std::make_shared(this)); + registerFeature( + std::make_shared(myGamesPath(), "fallout.ini")); + registerFeature(std::make_shared(this)); + registerFeature( + std::make_shared(m_Organizer->gameFeatures())); + registerFeature(std::make_shared(moInfo)); + registerFeature(std::make_shared(this)); + return true; } @@ -101,11 +104,12 @@ void GameFalloutNV::setGamePath(const QString& path) m_GamePath = path; checkVariants(); m_MyGamesPath = determineMyGamesPath(gameDirectoryName()); - registerFeature(new FalloutNVDataArchives(myGamesPath())); - registerFeature( - new FalloutNVBSAInvalidation(feature(), this)); - registerFeature( - new GamebryoLocalSavegames(myGamesPath(), "fallout.ini")); + + auto dataArchives = std::make_shared(myGamesPath()); + registerFeature(dataArchives); + registerFeature(std::make_shared(dataArchives.get(), this)); + registerFeature( + std::make_shared(myGamesPath(), "fallout.ini")); } QDir GameFalloutNV::savesDirectory() const @@ -157,7 +161,9 @@ QList GameFalloutNV::executables() const .withArgument("--game=\"FalloutNV\""); if (selectedVariant() != "Epic Games") { extraExecutables.prepend(ExecutableInfo( - "NVSE", findInGameFolder(feature()->loaderName()))); + "NVSE", findInGameFolder(m_Organizer->gameFeatures() + ->gameFeature() + ->loaderName()))); } else { game.withArgument("-EpicPortal"); launcher.withArgument("-EpicPortal");