Use WorldModel::mStore instead of MWBase::Environment::get().getESMStore()

macos_ci
elsid 2 years ago
parent 183202cd65
commit 60139c6bd5
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

@ -12,8 +12,6 @@
#include <components/loadinglistener/loadinglistener.hpp>
#include <components/settings/values.hpp>
#include "../mwbase/environment.hpp"
#include "cellstore.hpp"
#include "esmstore.hpp"
@ -146,7 +144,7 @@ void MWWorld::WorldModel::writeCell(ESM::ESMWriter& writer, CellStore& cell) con
writer.endRecord(ESM::REC_CSTA);
}
MWWorld::WorldModel::WorldModel(const MWWorld::ESMStore& store, ESM::ReadersCache& readers)
MWWorld::WorldModel::WorldModel(MWWorld::ESMStore& store, ESM::ReadersCache& readers)
: mStore(store)
, mReaders(readers)
, mIdCache(Settings::cells().mPointersCacheSize, { ESM::RefId(), nullptr })
@ -176,7 +174,7 @@ MWWorld::CellStore& MWWorld::WorldModel::getExterior(ESM::ExteriorCellLocation c
record.mMapColor = 0;
record.updateId();
cell = MWBase::Environment::get().getESMStore()->insert(record);
cell = mStore.insert(record);
}
CellStore* cellStore
@ -197,7 +195,7 @@ MWWorld::CellStore& MWWorld::WorldModel::getExterior(ESM::ExteriorCellLocation c
record.mX = cellIndex.mX;
record.mY = cellIndex.mY;
record.mCellFlags = !ESM4::CELL_Interior;
cell = MWBase::Environment::get().getESMStore()->insert(record);
cell = mStore.insert(record);
}
CellStore* cellStore
= &mCells.emplace(cell->mId, CellStore(MWWorld::Cell(*cell), mStore, mReaders)).first->second;

@ -39,7 +39,7 @@ namespace MWWorld
class WorldModel
{
public:
explicit WorldModel(const MWWorld::ESMStore& store, ESM::ReadersCache& reader);
explicit WorldModel(ESMStore& store, ESM::ReadersCache& reader);
WorldModel(const WorldModel&) = delete;
WorldModel& operator=(const WorldModel&) = delete;
@ -83,7 +83,7 @@ namespace MWWorld
bool readRecord(ESM::ESMReader& reader, uint32_t type, const std::map<int, int>& contentFileMap);
private:
const MWWorld::ESMStore& mStore;
MWWorld::ESMStore& mStore;
ESM::ReadersCache& mReaders;
mutable std::unordered_map<ESM::RefId, CellStore> mCells;
mutable std::map<std::string, CellStore*, Misc::StringUtils::CiComp> mInteriors;

Loading…
Cancel
Save