Skip to content

Commit

Permalink
Refactoring following uibase change for game features. (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
Holt59 authored Jun 9, 2024
1 parent 02d8624 commit 6366fed
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/falloutnvbsainvalidation.cpp
Original file line number Diff line number Diff line change
@@ -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)
{}
Expand Down
3 changes: 2 additions & 1 deletion src/falloutnvbsainvalidation.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/falloutnvdataarchives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
4 changes: 2 additions & 2 deletions src/falloutnvmoddatacontent.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/game_falloutNV_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
<context>
<name>GameFalloutNV</name>
<message>
<location filename="gamefalloutnv.cpp" line="182"/>
<location filename="gamefalloutnv.cpp" line="185"/>
<source>Fallout NV Support Plugin</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="gamefalloutnv.cpp" line="192"/>
<location filename="gamefalloutnv.cpp" line="195"/>
<source>Adds support for the game Fallout New Vegas</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="gamefalloutnv.cpp" line="204"/>
<location filename="gamefalloutnv.cpp" line="207"/>
<source>While not recommended by the FNV modding community, enables LOOT sorting</source>
<translation type="unfinished"></translation>
</message>
Expand Down
40 changes: 23 additions & 17 deletions src/gamefalloutnv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,20 @@ bool GameFalloutNV::init(IOrganizer* moInfo)
if (!GameGamebryo::init(moInfo)) {
return false;
}
registerFeature<ScriptExtender>(new FalloutNVScriptExtender(this));
registerFeature<DataArchives>(new FalloutNVDataArchives(myGamesPath()));
registerFeature<BSAInvalidation>(
new FalloutNVBSAInvalidation(feature<DataArchives>(), this));
registerFeature<SaveGameInfo>(new GamebryoSaveGameInfo(this));
registerFeature<LocalSavegames>(
new GamebryoLocalSavegames(myGamesPath(), "fallout.ini"));
registerFeature<ModDataChecker>(new FalloutNVModDataChecker(this));
registerFeature<ModDataContent>(new FalloutNVModDataContent(this));
registerFeature<GamePlugins>(new GamebryoGamePlugins(moInfo));
registerFeature<UnmanagedMods>(new GamebryoUnmangedMods(this));

auto dataArchives = std::make_shared<FalloutNVDataArchives>(myGamesPath());
registerFeature(std::make_shared<FalloutNVScriptExtender>(this));
registerFeature(dataArchives);
registerFeature(std::make_shared<FalloutNVBSAInvalidation>(dataArchives.get(), this));
registerFeature(std::make_shared<GamebryoSaveGameInfo>(this));
registerFeature(
std::make_shared<GamebryoLocalSavegames>(myGamesPath(), "fallout.ini"));
registerFeature(std::make_shared<FalloutNVModDataChecker>(this));
registerFeature(
std::make_shared<FalloutNVModDataContent>(m_Organizer->gameFeatures()));
registerFeature(std::make_shared<GamebryoGamePlugins>(moInfo));
registerFeature(std::make_shared<GamebryoUnmangedMods>(this));

return true;
}

Expand Down Expand Up @@ -101,11 +104,12 @@ void GameFalloutNV::setGamePath(const QString& path)
m_GamePath = path;
checkVariants();
m_MyGamesPath = determineMyGamesPath(gameDirectoryName());
registerFeature<DataArchives>(new FalloutNVDataArchives(myGamesPath()));
registerFeature<BSAInvalidation>(
new FalloutNVBSAInvalidation(feature<DataArchives>(), this));
registerFeature<LocalSavegames>(
new GamebryoLocalSavegames(myGamesPath(), "fallout.ini"));

auto dataArchives = std::make_shared<FalloutNVDataArchives>(myGamesPath());
registerFeature(dataArchives);
registerFeature(std::make_shared<FalloutNVBSAInvalidation>(dataArchives.get(), this));
registerFeature(
std::make_shared<GamebryoLocalSavegames>(myGamesPath(), "fallout.ini"));
}

QDir GameFalloutNV::savesDirectory() const
Expand Down Expand Up @@ -157,7 +161,9 @@ QList<ExecutableInfo> GameFalloutNV::executables() const
.withArgument("--game=\"FalloutNV\"");
if (selectedVariant() != "Epic Games") {
extraExecutables.prepend(ExecutableInfo(
"NVSE", findInGameFolder(feature<ScriptExtender>()->loaderName())));
"NVSE", findInGameFolder(m_Organizer->gameFeatures()
->gameFeature<MOBase::ScriptExtender>()
->loaderName())));
} else {
game.withArgument("-EpicPortal");
launcher.withArgument("-EpicPortal");
Expand Down

0 comments on commit 6366fed

Please sign in to comment.