From 08c3ecf5ae2a0caf4559dcca9258d9ef194f40a1 Mon Sep 17 00:00:00 2001 From: RJ Date: Thu, 12 Dec 2024 12:36:03 -0500 Subject: [PATCH] Prefer functional style when setting variant --- src/gamefallout3.cpp | 14 +++++++------- src/gamefallout3.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gamefallout3.cpp b/src/gamefallout3.cpp index 0be01e5..118778c 100644 --- a/src/gamefallout3.cpp +++ b/src/gamefallout3.cpp @@ -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)"; } } @@ -103,7 +103,7 @@ QString GameFallout3::gameName() const void GameFallout3::detectGame() { m_GamePath = identifyGamePath(); - checkVariants(); + setGameVariant(variantName()); m_MyGamesPath = determineMyGamesPath("Fallout3"); } diff --git a/src/gamefallout3.h b/src/gamefallout3.h index ec41954..783b955 100644 --- a/src/gamefallout3.h +++ b/src/gamefallout3.h @@ -52,7 +52,7 @@ class GameFallout3 : public GameGamebryo std::shared_ptr makeSaveGame(QString filePath) const override; private: - void checkVariants(); + QString variantName() const; }; #endif // GAMEFALLOUT3_H