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:
parent
3a66854c3c
commit
d98852fdbe
1 changed files with 3 additions and 7 deletions
|
@ -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…
Reference in a new issue