summaryrefslogtreecommitdiff
path: root/src/configuration.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/configuration.cpp')
-rw-r--r--src/configuration.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/configuration.cpp b/src/configuration.cpp
index ed2adfc61..54420a9f3 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -49,6 +49,7 @@ const std::string unusedKeys[] =
{
"AttackRange",
"emoteshortcut0",
+ "screenshotDirectory2",
"AttackRangeBorder",
"AttackRangeBorderDelay",
"AttackRangeBorderGradient",
@@ -205,7 +206,6 @@ const std::string unusedKeys[] =
"playerHomes",
"remember",
"screenshotDirectory",
- "screenshotDirectory2",
""
};
@@ -223,6 +223,7 @@ void ConfigurationObject::deleteKey(const std::string &key)
void Configuration::setValue(const std::string &key, const std::string &value)
{
ConfigurationObject::setValue(key, value);
+ mUpdated = true;
// Notify listeners
const ListenerMapIterator list = mListenerMap.find(key);
@@ -347,7 +348,8 @@ Configuration::Configuration() :
mDefaultsData(nullptr),
mDirectory(),
mFilename(),
- mUseResManager(false)
+ mUseResManager(false),
+ mUpdated(false)
{
#ifdef DEBUG_CONFIG
mLogKeys = false;
@@ -803,11 +805,18 @@ void ConfigurationObject::writeToXML(const XmlTextWriterPtr writer)
}
}
+void Configuration::writeUpdated()
+{
+ if (mUpdated)
+ write();
+}
+
void Configuration::write()
{
if (mConfigPath.empty())
return;
+ mUpdated = false;
// Do not attempt to write to file that cannot be opened for writing
FILE *const testFile = fopen(mConfigPath.c_str(), "w");
if (!testFile)
@@ -885,7 +894,8 @@ void Configuration::removeListeners(ConfigListener *const listener)
void Configuration::removeOldKeys()
{
if (mOptions.find(unusedKeys[0]) != mOptions.end()
- || mOptions.find(unusedKeys[1]) != mOptions.end())
+ || mOptions.find(unusedKeys[1]) != mOptions.end()
+ || mOptions.find(unusedKeys[2]) != mOptions.end())
{
int f = 0;
while (unusedKeys[f] != "")