From 4dbb3b148d874238b0f8dab323f198cc8d4e40c6 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Sat, 21 Nov 2015 17:26:34 +0000 Subject: Replace some instances of qApp->property("managed_game") with the saved pointer. Pedantic note: This doesn't help the possibility of supporting multiple executables greatly, we'd have to have a lot of register-for-change events. --- src/profile.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/profile.cpp') diff --git a/src/profile.cpp b/src/profile.cpp index b990fbc1..cf3622b0 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -18,6 +18,7 @@ along with Mod Organizer. If not, see . */ #include "profile.h" + #include "gameinfo.h" #include "windows_error.h" #include "modinfo.h" @@ -30,16 +31,18 @@ along with Mod Organizer. If not, see . #include #include #include + #include #include #include #include + #include +#include #define WIN32_LEAN_AND_MEAN #include #include -#include using namespace MOBase; using namespace MOShared; @@ -47,6 +50,7 @@ using namespace MOShared; Profile::Profile() : m_ModListWriter(std::bind(&Profile::writeModlistNow, this)) + , m_GamePlugin(qApp->property("managed_game").value()) { } @@ -101,6 +105,7 @@ Profile::Profile(const QString &name, IPluginGame *gamePlugin, bool useDefaultSe Profile::Profile(const QDir &directory, IPluginGame *gamePlugin) : m_Directory(directory) + , m_GamePlugin(gamePlugin) , m_ModListWriter(std::bind(&Profile::writeModlistNow, this)) { assert(gamePlugin != nullptr); @@ -568,10 +573,8 @@ void Profile::mergeTweaks(ModInfo::Ptr modInfo, const QString &tweakedIni) const bool Profile::invalidationActive(bool *supported) const { - IPluginGame *gamePlugin = qApp->property("managed_game").value(); - - BSAInvalidation *invalidation = gamePlugin->feature(); - DataArchives *dataArchives = gamePlugin->feature(); + BSAInvalidation *invalidation = m_GamePlugin->feature(); + DataArchives *dataArchives = m_GamePlugin->feature(); if ((invalidation != nullptr) && (dataArchives != nullptr)) { if (supported != nullptr) { @@ -593,9 +596,7 @@ bool Profile::invalidationActive(bool *supported) const void Profile::deactivateInvalidation() { - IPluginGame *gamePlugin = qApp->property("managed_game").value(); - - BSAInvalidation *invalidation = gamePlugin->feature(); + BSAInvalidation *invalidation = m_GamePlugin->feature(); if (invalidation != nullptr) { invalidation->deactivate(this); @@ -605,9 +606,7 @@ void Profile::deactivateInvalidation() void Profile::activateInvalidation() { - IPluginGame *gamePlugin = qApp->property("managed_game").value(); - - BSAInvalidation *invalidation = gamePlugin->feature(); + BSAInvalidation *invalidation = m_GamePlugin->feature(); if (invalidation != nullptr) { invalidation->activate(this); -- cgit v1.3.1