forked from teamnwah/openmw-tes3coop
Settings: reduce scope for better readability
This commit is contained in:
parent
33019b93b4
commit
fb1aa096be
1 changed files with 6 additions and 7 deletions
|
@ -50,7 +50,7 @@ namespace Config
|
|||
|
||||
bool readFile(QTextStream &stream)
|
||||
{
|
||||
mCache.clear();
|
||||
Map cache;
|
||||
|
||||
QString sectionPrefix;
|
||||
|
||||
|
@ -79,31 +79,30 @@ namespace Config
|
|||
|
||||
mSettings.remove(key);
|
||||
|
||||
QStringList values = mCache.values(key);
|
||||
QStringList values = cache.values(key);
|
||||
|
||||
if (!values.contains(value)) {
|
||||
if (mMultiValue) {
|
||||
mCache.insertMulti(key, value);
|
||||
cache.insertMulti(key, value);
|
||||
} else {
|
||||
mCache.insert(key, value);
|
||||
cache.insert(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mSettings.isEmpty()) {
|
||||
mSettings = mCache; // This is the first time we read a file
|
||||
mSettings = cache; // This is the first time we read a file
|
||||
return true;
|
||||
}
|
||||
|
||||
// Merge the changed keys with those which didn't
|
||||
mSettings.unite(mCache);
|
||||
mSettings.unite(cache);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
Map mSettings;
|
||||
Map mCache;
|
||||
|
||||
bool mMultiValue;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue