Skip to content

Commit

Permalink
Prefer functional style when setting variant
Browse files Browse the repository at this point in the history
  • Loading branch information
Liderate committed Dec 12, 2024
1 parent 89282d0 commit 08c3ecf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/gamefallout3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@ bool GameFallout3::init(IOrganizer* moInfo)
return true;
}

void GameFallout3::checkVariants()
QString GameFallout3::variantName() const
{
if (QFile::exists(m_GamePath + "/Fallout3ng.exe")) {
setGameVariant("Low Violence");
return "Low Violence";
} else if (QFile::exists(m_GamePath + "/Galaxy.dll")) {
setGameVariant("GOG");
return "GOG";
} else if (QFile::exists(m_GamePath + "/FalloutLauncherEpic.exe")) {
setGameVariant("Epic Games");
return "Epic Games";
} else if (m_GamePath.endsWith("Fallout 3 goty")) {
setGameVariant("Steam (Game of the Year)");
return "Steam (Game of the Year)";
} else {
setGameVariant("Steam (Regular)");
return "Steam (Regular)";
}
}

Expand Down Expand Up @@ -103,7 +103,7 @@ QString GameFallout3::gameName() const
void GameFallout3::detectGame()
{
m_GamePath = identifyGamePath();
checkVariants();
setGameVariant(variantName());
m_MyGamesPath = determineMyGamesPath("Fallout3");
}

Expand Down
2 changes: 1 addition & 1 deletion src/gamefallout3.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class GameFallout3 : public GameGamebryo
std::shared_ptr<const GamebryoSaveGame> makeSaveGame(QString filePath) const override;

private:
void checkVariants();
QString variantName() const;
};

#endif // GAMEFALLOUT3_H

0 comments on commit 08c3ecf

Please sign in to comment.