1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-26 15:39:51 +00:00

Workaround clang and actually erase from the vector

This commit is contained in:
Evil Eye 2021-07-13 21:18:24 +02:00
parent 86c50ece92
commit 1e1ebb049e

View File

@ -395,17 +395,18 @@ void ESMStore::validateDynamic()
template<class T> template<class T>
void ESMStore::removeMissingObjects(Store<T>& store) void ESMStore::removeMissingObjects(Store<T>& store)
{ {
for(auto& [id, list] : store.mDynamic) for(auto& entry : store.mDynamic)
{ {
std::remove_if(list.mList.begin(), list.mList.end(), [&] (const auto& item) auto first = std::remove_if(entry.second.mList.begin(), entry.second.mList.end(), [&] (const auto& item)
{ {
if(!find(item.mId)) if(!find(item.mId))
{ {
Log(Debug::Verbose) << "Leveled list '" << id << "' has nonexistent object '" << item.mId << "', ignoring it."; Log(Debug::Verbose) << "Leveled list '" << entry.first << "' has nonexistent object '" << item.mId << "', ignoring it.";
return true; return true;
} }
return false; return false;
}); });
entry.second.mList.erase(first, entry.second.mList.end());
} }
} }