mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-20 19:41:36 +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 "worldmodel.hpp"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <components/debug/debuglog.hpp>
|
#include <components/debug/debuglog.hpp>
|
||||||
#include <components/esm/defs.hpp>
|
#include <components/esm/defs.hpp>
|
||||||
#include <components/esm3/cellid.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 MWWorld::WorldModel::countSavedGameRecords() const
|
||||||
{
|
{
|
||||||
int count = 0;
|
return std::count_if(mCells.begin(), mCells.end(), [](const auto& v) { return v.second.hasState(); });
|
||||||
|
|
||||||
for (auto iter(mCells.begin()); iter != mCells.end(); ++iter)
|
|
||||||
if (iter->second.hasState())
|
|
||||||
++count;
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWWorld::WorldModel::write(ESM::ESMWriter& writer, Loading::Listener& progress) const
|
void MWWorld::WorldModel::write(ESM::ESMWriter& writer, Loading::Listener& progress) const
|
||||||
|
|
Loading…
Reference in a new issue