Skip to content

Commit

Permalink
Refactoring of game features for better management. (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
Holt59 authored Jun 9, 2024
1 parent a23d73d commit b3ba731
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/falloutttwbsainvalidation.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "falloutttwbsainvalidation.h"

FalloutTTWBSAInvalidation::FalloutTTWBSAInvalidation(DataArchives* dataArchives,
FalloutTTWBSAInvalidation::FalloutTTWBSAInvalidation(MOBase::DataArchives* dataArchives,
MOBase::IPluginGame const* game)
: GamebryoBSAInvalidation(dataArchives, "fallout.ini", game)
{}
Expand Down
2 changes: 1 addition & 1 deletion src/falloutttwbsainvalidation.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class FalloutTTWBSAInvalidation : public GamebryoBSAInvalidation
{
public:
FalloutTTWBSAInvalidation(DataArchives* dataArchives,
FalloutTTWBSAInvalidation(MOBase::DataArchives* dataArchives,
MOBase::IPluginGame const* game);

private:
Expand Down
4 changes: 2 additions & 2 deletions src/falloutttwmoddatacontent.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class FalloutTTWModDataContent : public GamebryoModDataContent
/**
*
*/
FalloutTTWModDataContent(GameGamebryo const* gamePlugin)
: GamebryoModDataContent(gamePlugin)
FalloutTTWModDataContent(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_ttw_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
<context>
<name>GameFalloutTTW</name>
<message>
<location filename="gamefalloutttw.cpp" line="186"/>
<location filename="gamefalloutttw.cpp" line="193"/>
<source>Fallout TTW Support Plugin</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="gamefalloutttw.cpp" line="196"/>
<location filename="gamefalloutttw.cpp" line="203"/>
<source>Adds support for the game Fallout TTW</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="gamefalloutttw.cpp" line="208"/>
<location filename="gamefalloutttw.cpp" line="215"/>
<source>While not recommended by the TTW modding community, enables LOOT sorting</source>
<translation type="unfinished"></translation>
</message>
Expand Down
41 changes: 24 additions & 17 deletions src/gamefalloutttw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,20 @@ bool GameFalloutTTW::init(IOrganizer* moInfo)
return false;
}

registerFeature<ScriptExtender>(new FalloutTTWScriptExtender(this));
registerFeature<DataArchives>(new FalloutTTWDataArchives(myGamesPath()));
registerFeature<BSAInvalidation>(
new FalloutTTWBSAInvalidation(feature<DataArchives>(), this));
registerFeature<SaveGameInfo>(new GamebryoSaveGameInfo(this));
registerFeature<LocalSavegames>(
new GamebryoLocalSavegames(myGamesPath(), "fallout.ini"));
registerFeature<ModDataChecker>(new FalloutTTWModDataChecker(this));
registerFeature<ModDataContent>(new FalloutTTWModDataContent(this));
registerFeature<GamePlugins>(new GamebryoGamePlugins(moInfo));
registerFeature<UnmanagedMods>(new GamebryoUnmangedMods(this));
auto dataArchives = std::make_shared<FalloutTTWDataArchives>(myGamesPath());
registerFeature(std::make_shared<FalloutTTWScriptExtender>(this));
registerFeature(dataArchives);
registerFeature(
std::make_shared<FalloutTTWBSAInvalidation>(dataArchives.get(), this));
registerFeature(std::make_shared<GamebryoSaveGameInfo>(this));
registerFeature(
std::make_shared<GamebryoLocalSavegames>(myGamesPath(), "fallout.ini"));
registerFeature(std::make_shared<FalloutTTWModDataChecker>(this));
registerFeature(
std::make_shared<FalloutTTWModDataContent>(m_Organizer->gameFeatures()));
registerFeature(std::make_shared<GamebryoGamePlugins>(moInfo));
registerFeature(std::make_shared<GamebryoUnmangedMods>(this));

return true;
}

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

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

QDir GameFalloutTTW::savesDirectory() const
Expand Down Expand Up @@ -161,7 +166,9 @@ QList<ExecutableInfo> GameFalloutTTW::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 b3ba731

Please sign in to comment.