mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-03 07:09:40 +00:00
Minor optimisation in VFS::FileSystemArchive::listResources
When there is no cache, we can fill the `out` variable as we create it, instead of creating the cache, and then iterating it to fill `out`. Thanks to @cemoc for the help!
This commit is contained in:
parent
df3a47187b
commit
5375b8e71b
1 changed files with 9 additions and 5 deletions
|
@ -40,16 +40,20 @@ namespace VFS
|
|||
|
||||
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.";
|
||||
else
|
||||
out[inserted.first->first] = &inserted.first->second;
|
||||
}
|
||||
|
||||
mBuiltIndex = true;
|
||||
}
|
||||
|
||||
for (index::iterator it = mIndex.begin(); it != mIndex.end(); ++it)
|
||||
else
|
||||
{
|
||||
out[it->first] = &it->second;
|
||||
for (index::iterator it = mIndex.begin(); it != mIndex.end(); ++it)
|
||||
{
|
||||
out[it->first] = &it->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue