mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-10 15:45:37 +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 "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…
x
Reference in New Issue
Block a user