1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Remove functions WorldModel::rest and WorldModel::recharge

This commit is contained in:
Petr Mikheev 2022-12-23 22:17:06 +01:00
parent b8fb013edf
commit 0fef8f12d0
3 changed files with 11 additions and 30 deletions

View File

@ -3401,7 +3401,7 @@ namespace MWWorld
void World::rest(double hours)
{
mWorldModel.rest(hours);
mWorldModel.forEachLoadedCellStore([hours](CellStore& store) { store.rest(hours); });
}
void World::rechargeItems(double duration, bool activeOnly)
@ -3417,7 +3417,7 @@ namespace MWWorld
}
}
else
mWorldModel.recharge(duration);
mWorldModel.forEachLoadedCellStore([duration](CellStore& store) { store.recharge(duration); });
}
void World::teleportToClosestMarker(const MWWorld::Ptr& ptr, const ESM::RefId& id)

View File

@ -212,32 +212,6 @@ MWWorld::CellStore* MWWorld::WorldModel::getInterior(const ESM::RefId& name)
return &result->second;
}
void MWWorld::WorldModel::rest(double hours)
{
for (auto& interior : mInteriors)
{
interior.second.rest(hours);
}
for (auto& exterior : mExteriors)
{
exterior.second.rest(hours);
}
}
void MWWorld::WorldModel::recharge(float duration)
{
for (auto& interior : mInteriors)
{
interior.second.recharge(duration);
}
for (auto& exterior : mExteriors)
{
exterior.second.recharge(duration);
}
}
MWWorld::CellStore* MWWorld::WorldModel::getCell(const ESM::CellId& id)
{
if (id.mPaged)

View File

@ -6,6 +6,7 @@
#include <string>
#include <unordered_map>
#include "cellstore.hpp"
#include "ptr.hpp"
namespace ESM
@ -82,8 +83,14 @@ namespace MWWorld
Ptr getPtr(const ESM::RefId& id, const ESM::RefNum& refNum);
void rest(double hours);
void recharge(float duration);
template <typename Fn>
void forEachLoadedCellStore(Fn&& fn)
{
for (auto& [_, store] : mInteriors)
fn(store);
for (auto& [_, store] : mExteriors)
fn(store);
}
/// Get all Ptrs referencing \a name in exterior cells
/// @note Due to the current implementation of getPtr this only supports one Ptr per cell.