mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-26 10:41:33 +00:00
Try create CellStore for interior cell when not found
This commit is contained in:
parent
1843345510
commit
01775dd6f0
1 changed files with 20 additions and 5 deletions
|
@ -175,12 +175,27 @@ namespace MWWorld
|
||||||
CellStore* WorldModel::findInterior(std::string_view name, bool forceLoad) const
|
CellStore* WorldModel::findInterior(std::string_view name, bool forceLoad) const
|
||||||
{
|
{
|
||||||
const auto it = mInteriors.find(name);
|
const auto it = mInteriors.find(name);
|
||||||
|
CellStore* cellStore = nullptr;
|
||||||
|
|
||||||
if (it == mInteriors.end())
|
if (it == mInteriors.end())
|
||||||
return nullptr;
|
{
|
||||||
assert(it->second != nullptr);
|
if (const ESM::Cell* cell = mStore.get<ESM::Cell>().search(name))
|
||||||
if (forceLoad && it->second->getState() != CellStore::State_Loaded)
|
cellStore = &emplaceCellStore(cell->mId, *cell, mStore, mReaders, mCells);
|
||||||
it->second->load();
|
else if (const ESM4::Cell* cell4 = mStore.get<ESM4::Cell>().searchCellName(name))
|
||||||
return it->second;
|
cellStore = &emplaceCellStore(cell4->mId, *cell4, mStore, mReaders, mCells);
|
||||||
|
else
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
assert(it->second != nullptr);
|
||||||
|
cellStore = it->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (forceLoad && cellStore->getState() != CellStore::State_Loaded)
|
||||||
|
cellStore->load();
|
||||||
|
|
||||||
|
return cellStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
CellStore& WorldModel::getInterior(std::string_view name, bool forceLoad) const
|
CellStore& WorldModel::getInterior(std::string_view name, bool forceLoad) const
|
||||||
|
|
Loading…
Reference in a new issue