summaryrefslogtreecommitdiff
path: root/src/profile.cpp
diff options
context:
space:
mode:
authorThomas Tanner <trtanner@btinternet.com>2015-11-25 08:22:40 +0000
committerThomas Tanner <trtanner@btinternet.com>2015-11-25 08:22:40 +0000
commit78b686b2bc507a5606bc7c673745b02346bc667a (patch)
treed161d6096289aed99cfb1bf79cce4c2404c202dd /src/profile.cpp
parent42a68689fe60ba29367dc0c8f65083d9bde93e1f (diff)
Removes all references to GameInfo::getGameDirectory apart from one during startup
Did some const correctness improvements Also may have fixed a potential crash as the Profile copy constructor didn't copy the m_GamePlugin membber
Diffstat (limited to 'src/profile.cpp')
-rw-r--r--src/profile.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/profile.cpp b/src/profile.cpp
index 42dc56d1..77f6ebd1 100644
--- a/src/profile.cpp
+++ b/src/profile.cpp
@@ -54,7 +54,7 @@ void Profile::touchFile(QString fileName)
}
}
-Profile::Profile(const QString &name, IPluginGame *gamePlugin, bool useDefaultSettings)
+Profile::Profile(const QString &name, IPluginGame const *gamePlugin, bool useDefaultSettings)
: m_ModListWriter(std::bind(&Profile::writeModlistNow, this))
, m_GamePlugin(gamePlugin)
{
@@ -95,7 +95,7 @@ Profile::Profile(const QString &name, IPluginGame *gamePlugin, bool useDefaultSe
}
-Profile::Profile(const QDir &directory, IPluginGame *gamePlugin)
+Profile::Profile(const QDir &directory, IPluginGame const *gamePlugin)
: m_Directory(directory)
, m_GamePlugin(gamePlugin)
, m_ModListWriter(std::bind(&Profile::writeModlistNow, this))
@@ -122,6 +122,8 @@ Profile::Profile(const QDir &directory, IPluginGame *gamePlugin)
Profile::Profile(const Profile &reference)
: m_Directory(reference.m_Directory)
, m_ModListWriter(std::bind(&Profile::writeModlistNow, this))
+ , m_GamePlugin(reference.m_GamePlugin)
+
{
refreshModStatus();
}
@@ -483,7 +485,7 @@ void Profile::setModPriority(unsigned int index, int &newPriority)
m_ModListWriter.write();
}
-Profile *Profile::createPtrFrom(const QString &name, const Profile &reference, MOBase::IPluginGame *gamePlugin)
+Profile *Profile::createPtrFrom(const QString &name, const Profile &reference, MOBase::IPluginGame const *gamePlugin)
{
QString profileDirectory = qApp->property("dataPath").toString() + "/" + QString::fromStdWString(AppConfig::profilesPath()) + "/" + name;
reference.copyFilesTo(profileDirectory);