mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-29 22:20:33 +00:00
Use std::count_if to implement WorldModel::countSavedGameRecords
This commit is contained in:
parent
3a66854c3c
commit
d98852fdbe
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user