mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-31 12:45:36 +00:00
Cleanup(CSVRender::Cell:updateLand): Early exit when landscape should
not be loaded
This commit is contained in:
parent
c215ee2f6f
commit
09f41c9464
1 changed files with 25 additions and 24 deletions
|
@ -133,32 +133,33 @@ void CSVRender::Cell::updateLand()
|
||||||
// Setup land if available
|
// Setup land if available
|
||||||
const CSMWorld::IdCollection<CSMWorld::Land>& land = mData.getLand();
|
const CSMWorld::IdCollection<CSMWorld::Land>& land = mData.getLand();
|
||||||
int landIndex = land.searchId(mId);
|
int landIndex = land.searchId(mId);
|
||||||
if (landIndex != -1 && !land.getRecord(mId).isDeleted())
|
|
||||||
|
if (landIndex == -1 || land.getRecord(mId).isDeleted())
|
||||||
|
return;
|
||||||
|
|
||||||
|
const ESM::Land& esmLand = land.getRecord(mId).get();
|
||||||
|
|
||||||
|
if (!esmLand.getLandData(ESM::Land::DATA_VHGT))
|
||||||
|
mTerrainStorage->resetHeights();
|
||||||
|
|
||||||
|
if (mTerrain)
|
||||||
{
|
{
|
||||||
const ESM::Land& esmLand = land.getRecord(mId).get();
|
mTerrain->unloadCell(mCoordinates.getX(), mCoordinates.getY());
|
||||||
|
mTerrain->clearAssociatedCaches();
|
||||||
if (!esmLand.getLandData(ESM::Land::DATA_VHGT))
|
|
||||||
mTerrainStorage->resetHeights();
|
|
||||||
|
|
||||||
if (mTerrain)
|
|
||||||
{
|
|
||||||
mTerrain->unloadCell(mCoordinates.getX(), mCoordinates.getY());
|
|
||||||
mTerrain->clearAssociatedCaches();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
constexpr double expiryDelay = 0;
|
|
||||||
mTerrain = std::make_unique<Terrain::TerrainGrid>(mCellNode, mCellNode, mData.getResourceSystem().get(),
|
|
||||||
mTerrainStorage, Mask_Terrain, ESM::Cell::sDefaultWorldspaceId, expiryDelay);
|
|
||||||
}
|
|
||||||
|
|
||||||
mTerrain->loadCell(esmLand.mX, esmLand.mY);
|
|
||||||
|
|
||||||
if (!mCellBorder)
|
|
||||||
mCellBorder = std::make_unique<CellBorder>(mCellNode, mCoordinates);
|
|
||||||
|
|
||||||
mCellBorder->buildShape(esmLand);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
constexpr double expiryDelay = 0;
|
||||||
|
mTerrain = std::make_unique<Terrain::TerrainGrid>(mCellNode, mCellNode, mData.getResourceSystem().get(),
|
||||||
|
mTerrainStorage, Mask_Terrain, ESM::Cell::sDefaultWorldspaceId, expiryDelay);
|
||||||
|
}
|
||||||
|
|
||||||
|
mTerrain->loadCell(esmLand.mX, esmLand.mY);
|
||||||
|
|
||||||
|
if (!mCellBorder)
|
||||||
|
mCellBorder = std::make_unique<CellBorder>(mCellNode, mCoordinates);
|
||||||
|
|
||||||
|
mCellBorder->buildShape(esmLand);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVRender::Cell::unloadLand()
|
void CSVRender::Cell::unloadLand()
|
||||||
|
|
Loading…
Reference in a new issue