1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 06:53:53 +00:00

Merge branch 'list_resources' into 'master'

Minor optimisation in VFS::FileSystemArchive::listResources

See merge request OpenMW/openmw!932
This commit is contained in:
Evil Eye 2021-06-24 19:11:46 +00:00
commit 822e331f64

View file

@ -40,16 +40,20 @@ namespace VFS
std::transform(proper.begin() + prefix, proper.end(), std::back_inserter(searchable), normalize_function); std::transform(proper.begin() + prefix, proper.end(), std::back_inserter(searchable), normalize_function);
if (!mIndex.insert (std::make_pair (searchable, file)).second) const auto inserted = mIndex.insert(std::make_pair(searchable, file));
if (!inserted.second)
Log(Debug::Warning) << "Warning: found duplicate file for '" << proper << "', please check your file system for two files with the same name in different cases."; Log(Debug::Warning) << "Warning: found duplicate file for '" << proper << "', please check your file system for two files with the same name in different cases.";
else
out[inserted.first->first] = &inserted.first->second;
} }
mBuiltIndex = true; mBuiltIndex = true;
} }
else
for (index::iterator it = mIndex.begin(); it != mIndex.end(); ++it)
{ {
out[it->first] = &it->second; for (index::iterator it = mIndex.begin(); it != mIndex.end(); ++it)
{
out[it->first] = &it->second;
}
} }
} }