1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-21 09:39:43 +00:00

Use std::count_if to implement WorldModel::countSavedGameRecords

This commit is contained in:
elsid 2023-05-27 14:56:28 +02:00
parent 3a66854c3c
commit d98852fdbe
No known key found for this signature in database
GPG key ID: 4DE04C198CBA7625

View file

@ -1,5 +1,7 @@
#include "worldmodel.hpp"
#include <algorithm>
#include <components/debug/debuglog.hpp>
#include <components/esm/defs.hpp>
#include <components/esm3/cellid.hpp>
@ -397,13 +399,7 @@ std::vector<MWWorld::Ptr> MWWorld::WorldModel::getAll(const ESM::RefId& id)
int MWWorld::WorldModel::countSavedGameRecords() const
{
int count = 0;
for (auto iter(mCells.begin()); iter != mCells.end(); ++iter)
if (iter->second.hasState())
++count;
return count;
return std::count_if(mCells.begin(), mCells.end(), [](const auto& v) { return v.second.hasState(); });
}
void MWWorld::WorldModel::write(ESM::ESMWriter& writer, Loading::Listener& progress) const