1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-07-08 04:11:35 +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:
psi29a 2025-06-11 09:37:56 +00:00
commit 5163214878

View file

@ -189,19 +189,16 @@ bool Config::GameSettings::readFile(
if (ignoreContent && (key == QLatin1String("content") || key == QLatin1String("data")))
continue;
QList<SettingValue> values = cache.values(key);
values.append(settings.values(key));
bool exists = false;
for (const auto& existingValue : values)
{
if (existingValue.value == value.value)
auto containsValue = [&](const QMultiMap<QString, SettingValue>& map) {
for (auto [itr, end] = map.equal_range(key); itr != end; ++itr)
{
exists = true;
break;
if (itr->value == value.value)
return true;
}
}
if (!exists)
return false;
};
if (!containsValue(cache) && !containsValue(settings))
{
cache.insert(key, value);
}