mirror of
https://github.com/OpenMW/openmw.git
synced 2025-12-18 15:43:10 +00:00
Merge branch 'readfileqlists' into 'master'
Optimize value deduping in Qt openmw.cfg loading See merge request OpenMW/openmw!4708
This commit is contained in:
commit
5163214878
1 changed files with 8 additions and 11 deletions
|
|
@ -189,19 +189,16 @@ bool Config::GameSettings::readFile(
|
||||||
if (ignoreContent && (key == QLatin1String("content") || key == QLatin1String("data")))
|
if (ignoreContent && (key == QLatin1String("content") || key == QLatin1String("data")))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QList<SettingValue> values = cache.values(key);
|
auto containsValue = [&](const QMultiMap<QString, SettingValue>& map) {
|
||||||
values.append(settings.values(key));
|
for (auto [itr, end] = map.equal_range(key); itr != end; ++itr)
|
||||||
|
|
||||||
bool exists = false;
|
|
||||||
for (const auto& existingValue : values)
|
|
||||||
{
|
|
||||||
if (existingValue.value == value.value)
|
|
||||||
{
|
{
|
||||||
exists = true;
|
if (itr->value == value.value)
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
return false;
|
||||||
if (!exists)
|
};
|
||||||
|
|
||||||
|
if (!containsValue(cache) && !containsValue(settings))
|
||||||
{
|
{
|
||||||
cache.insert(key, value);
|
cache.insert(key, value);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue