From 49de6e8d2555234c5da132c5fc35287083fe7ef7 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Fri, 20 Nov 2015 18:07:06 +0000 Subject: Get rid of `GameIfo::getOrganizerDirectory` and associated member variable qApp->getProperty("dataPath") can be used instead (and is pretty much everywhere else) so it's unnecessary --- src/shared/fallout3info.cpp | 4 ++-- src/shared/fallout3info.h | 2 +- src/shared/falloutnvinfo.cpp | 4 ++-- src/shared/falloutnvinfo.h | 2 +- src/shared/gameinfo.cpp | 18 +++++++++--------- src/shared/gameinfo.h | 14 +++++++++----- src/shared/oblivioninfo.cpp | 4 ++-- src/shared/oblivioninfo.h | 2 +- src/shared/skyriminfo.cpp | 4 ++-- src/shared/skyriminfo.h | 2 +- 10 files changed, 30 insertions(+), 26 deletions(-) (limited to 'src/shared') diff --git a/src/shared/fallout3info.cpp b/src/shared/fallout3info.cpp index 0b369b50..055d3b38 100644 --- a/src/shared/fallout3info.cpp +++ b/src/shared/fallout3info.cpp @@ -30,8 +30,8 @@ along with Mod Organizer. If not, see . namespace MOShared { -Fallout3Info::Fallout3Info(const std::wstring &moDirectory, const std::wstring &moDataDirectory, const std::wstring &gameDirectory) - : GameInfo(moDirectory, moDataDirectory, gameDirectory) +Fallout3Info::Fallout3Info(const std::wstring &moDataDirectory, const std::wstring &gameDirectory) + : GameInfo(moDataDirectory, gameDirectory) { identifyMyGamesDirectory(L"fallout3"); } diff --git a/src/shared/fallout3info.h b/src/shared/fallout3info.h index 0045581d..d019ee07 100644 --- a/src/shared/fallout3info.h +++ b/src/shared/fallout3info.h @@ -69,7 +69,7 @@ public: private: - Fallout3Info(const std::wstring &moDirectory, const std::wstring &moDataDirectory, const std::wstring &gameDirectory); + Fallout3Info(const std::wstring &moDataDirectory, const std::wstring &gameDirectory); static bool identifyGame(const std::wstring &searchPath); diff --git a/src/shared/falloutnvinfo.cpp b/src/shared/falloutnvinfo.cpp index 1203bd25..2ddbf055 100644 --- a/src/shared/falloutnvinfo.cpp +++ b/src/shared/falloutnvinfo.cpp @@ -31,8 +31,8 @@ along with Mod Organizer. If not, see . namespace MOShared { -FalloutNVInfo::FalloutNVInfo(const std::wstring &moDirectory, const std::wstring &moDataDirectory, const std::wstring &gameDirectory) - : GameInfo(moDirectory, moDataDirectory, gameDirectory) +FalloutNVInfo::FalloutNVInfo(const std::wstring &moDataDirectory, const std::wstring &gameDirectory) + : GameInfo(moDataDirectory, gameDirectory) { identifyMyGamesDirectory(L"falloutnv"); } diff --git a/src/shared/falloutnvinfo.h b/src/shared/falloutnvinfo.h index e1a614d2..9a9004ec 100644 --- a/src/shared/falloutnvinfo.h +++ b/src/shared/falloutnvinfo.h @@ -102,7 +102,7 @@ public: private: - FalloutNVInfo(const std::wstring &moDirectory, const std::wstring &moDataDirectory, const std::wstring &gameDirectory); + FalloutNVInfo(const std::wstring &moDataDirectory, const std::wstring &gameDirectory); static bool identifyGame(const std::wstring &searchPath); }; diff --git a/src/shared/gameinfo.cpp b/src/shared/gameinfo.cpp index 1f25cec1..e5e47cdf 100644 --- a/src/shared/gameinfo.cpp +++ b/src/shared/gameinfo.cpp @@ -40,8 +40,8 @@ namespace MOShared { GameInfo* GameInfo::s_Instance = nullptr; -GameInfo::GameInfo(const std::wstring &moDirectory, const std::wstring &moDataDirectory, const std::wstring &gameDirectory) - : m_GameDirectory(gameDirectory), m_OrganizerDirectory(moDirectory), m_OrganizerDataDirectory(moDataDirectory) +GameInfo::GameInfo(const std::wstring &moDataDirectory, const std::wstring &gameDirectory) + : m_GameDirectory(gameDirectory), m_OrganizerDataDirectory(moDataDirectory) { atexit(&cleanup); } @@ -87,16 +87,16 @@ void GameInfo::identifyMyGamesDirectory(const std::wstring &file) } -bool GameInfo::identifyGame(const std::wstring &moDirectory, const std::wstring &moDataDirectory, const std::wstring &searchPath) +bool GameInfo::identifyGame(const std::wstring &moDataDirectory, const std::wstring &searchPath) { if (OblivionInfo::identifyGame(searchPath)) { - s_Instance = new OblivionInfo(moDirectory, moDataDirectory, searchPath); + s_Instance = new OblivionInfo(moDataDirectory, searchPath); } else if (Fallout3Info::identifyGame(searchPath)) { - s_Instance = new Fallout3Info(moDirectory, moDataDirectory, searchPath); + s_Instance = new Fallout3Info(moDataDirectory, searchPath); } else if (FalloutNVInfo::identifyGame(searchPath)) { - s_Instance = new FalloutNVInfo(moDirectory, moDataDirectory, searchPath); + s_Instance = new FalloutNVInfo(moDataDirectory, searchPath); } else if (SkyrimInfo::identifyGame(searchPath)) { - s_Instance = new SkyrimInfo(moDirectory, moDataDirectory, searchPath); + s_Instance = new SkyrimInfo(moDataDirectory, searchPath); } return s_Instance != nullptr; @@ -109,14 +109,14 @@ bool GameInfo::init(const std::wstring &moDirectory, const std::wstring &moDataD if (gamePath.length() == 0) { // search upward in the directory until a recognized game-binary is found std::wstring searchPath(moDirectory); - while (!identifyGame(moDirectory, moDataDirectory, searchPath)) { + while (!identifyGame(moDataDirectory, searchPath)) { size_t lastSep = searchPath.find_last_of(L"/\\"); if (lastSep == std::string::npos) { return false; } searchPath.erase(lastSep); } - } else if (!identifyGame(moDirectory, moDataDirectory, gamePath)) { + } else if (!identifyGame(moDataDirectory, gamePath)) { return false; } } diff --git a/src/shared/gameinfo.h b/src/shared/gameinfo.h index a32b6b82..1d4b050b 100644 --- a/src/shared/gameinfo.h +++ b/src/shared/gameinfo.h @@ -56,8 +56,7 @@ public: virtual ~GameInfo() {} - std::wstring getOrganizerDirectory() { return m_OrganizerDirectory; } - + //**USED IN HOOKDLL virtual std::wstring getRegPath() = 0; virtual std::wstring getBinaryName() = 0; @@ -70,6 +69,7 @@ public: /// exception if the mechanism can't be determined virtual LoadOrderMechanism getLoadOrderMechanism() const { return TYPE_FILETIME; } + //**USED IN HOOKDLL virtual std::wstring getGameDirectory() const; virtual bool requiresSteam() const; @@ -80,9 +80,11 @@ public: // get a set of esp/esm files that are part of known dlcs virtual std::vector getDLCPlugins() = 0; + //**USED IN HOOKDLL // file name of this games ini file(s) virtual std::vector getIniFileNames() = 0; + //**USED IN HOOKDLL virtual std::wstring getReferenceDataFile() = 0; virtual std::wstring getNexusPage(bool nmmScheme = true) = 0; @@ -90,19 +92,22 @@ public: virtual int getNexusModID() = 0; virtual int getNexusGameID() = 0; + //**USED IN HOOKDLL virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath) = 0; public: + //**USED IN HOOKDLL // initialise with the path to the mo directory (needs to be where hook.dll is stored). This // needs to be called before the instance can be retrieved static bool init(const std::wstring &moDirectory, const std::wstring &moDataDirectory, const std::wstring &gamePath = L""); + //**USED IN HOOKDLL static GameInfo& instance(); protected: - GameInfo(const std::wstring &moDirectory, const std::wstring &moDataDirectory, const std::wstring &gameDirectory); + GameInfo(const std::wstring &moDataDirectory, const std::wstring &gameDirectory); std::wstring getLocalAppFolder() const; const std::wstring &getMyGamesDirectory() const { return m_MyGamesDirectory; } @@ -110,7 +115,7 @@ protected: private: - static bool identifyGame(const std::wstring &moDirectory, const std::wstring &moDataDirectory, const std::wstring &searchPath); + static bool identifyGame(const std::wstring &moDataDirectory, const std::wstring &searchPath); std::wstring getSpecialPath(LPCWSTR name) const; static void cleanup(); @@ -122,7 +127,6 @@ private: std::wstring m_MyGamesDirectory; std::wstring m_GameDirectory; - std::wstring m_OrganizerDirectory; std::wstring m_OrganizerDataDirectory; }; diff --git a/src/shared/oblivioninfo.cpp b/src/shared/oblivioninfo.cpp index 16748f58..a5760570 100644 --- a/src/shared/oblivioninfo.cpp +++ b/src/shared/oblivioninfo.cpp @@ -31,8 +31,8 @@ along with Mod Organizer. If not, see . namespace MOShared { -OblivionInfo::OblivionInfo(const std::wstring &moDirectory, const std::wstring &moDataDirectory, const std::wstring &gameDirectory) - : GameInfo(moDirectory, moDataDirectory, gameDirectory) +OblivionInfo::OblivionInfo(const std::wstring &moDataDirectory, const std::wstring &gameDirectory) + : GameInfo(moDataDirectory, gameDirectory) { identifyMyGamesDirectory(L"oblivion"); } diff --git a/src/shared/oblivioninfo.h b/src/shared/oblivioninfo.h index 87ba26ff..0a6c416c 100644 --- a/src/shared/oblivioninfo.h +++ b/src/shared/oblivioninfo.h @@ -100,7 +100,7 @@ public: private: - OblivionInfo(const std::wstring &moDirectory, const std::wstring &moDataDirectory, const std::wstring &gameDirectory); + OblivionInfo(const std::wstring &moDataDirectory, const std::wstring &gameDirectory); static bool identifyGame(const std::wstring &searchPath); diff --git a/src/shared/skyriminfo.cpp b/src/shared/skyriminfo.cpp index f66fcef4..e122390d 100644 --- a/src/shared/skyriminfo.cpp +++ b/src/shared/skyriminfo.cpp @@ -33,8 +33,8 @@ along with Mod Organizer. If not, see . namespace MOShared { -SkyrimInfo::SkyrimInfo(const std::wstring &moDirectory, const std::wstring &moDataDirectory, const std::wstring &gameDirectory) - : GameInfo(moDirectory, moDataDirectory, gameDirectory) +SkyrimInfo::SkyrimInfo(const std::wstring &moDataDirectory, const std::wstring &gameDirectory) + : GameInfo(moDataDirectory, gameDirectory) { identifyMyGamesDirectory(L"skyrim"); diff --git a/src/shared/skyriminfo.h b/src/shared/skyriminfo.h index 5951f910..f52be73a 100644 --- a/src/shared/skyriminfo.h +++ b/src/shared/skyriminfo.h @@ -68,7 +68,7 @@ public: private: - SkyrimInfo(const std::wstring &moDirectory, const std::wstring &moDataDirectory, const std::wstring &gameDirectory); + SkyrimInfo(const std::wstring &moDataDirectory, const std::wstring &gameDirectory); static bool identifyGame(const std::wstring &searchPath); -- cgit v1.3.1