mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 15:35:23 +00:00
Load existing exterior CellStore when required
This commit is contained in:
parent
01775dd6f0
commit
457fa16e37
@ -160,16 +160,26 @@ namespace MWWorld
|
||||
{
|
||||
CellStore& WorldModel::getExterior(ESM::ExteriorCellLocation location, bool forceLoad) const
|
||||
{
|
||||
auto it = mExteriors.find(location);
|
||||
if (it != mExteriors.end())
|
||||
return *it->second;
|
||||
Cell cell = createExteriorCell(location, mStore);
|
||||
const ESM::RefId id = cell.getId();
|
||||
CellStore& cellStore = emplaceCellStore(id, std::move(cell), mStore, mReaders, mCells);
|
||||
mExteriors.emplace(location, &cellStore);
|
||||
if (forceLoad && cellStore.getState() != CellStore::State_Loaded)
|
||||
cellStore.load();
|
||||
return cellStore;
|
||||
const auto it = mExteriors.find(location);
|
||||
CellStore* cellStore = nullptr;
|
||||
|
||||
if (it == mExteriors.end())
|
||||
{
|
||||
Cell cell = createExteriorCell(location, mStore);
|
||||
const ESM::RefId id = cell.getId();
|
||||
cellStore = &emplaceCellStore(id, std::move(cell), mStore, mReaders, mCells);
|
||||
mExteriors.emplace(location, cellStore);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(it->second != nullptr);
|
||||
cellStore = it->second;
|
||||
}
|
||||
|
||||
if (forceLoad && cellStore->getState() != CellStore::State_Loaded)
|
||||
cellStore->load();
|
||||
|
||||
return *cellStore;
|
||||
}
|
||||
|
||||
CellStore* WorldModel::findInterior(std::string_view name, bool forceLoad) const
|
||||
|
Loading…
x
Reference in New Issue
Block a user