mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-21 17:39:40 +00:00
Always unload height fields
loadCell always adds a height field, but unloadCell only removed it for cells with height data. Reloading a cell overwrote the height field added earlier (leading to its destruction) while the navigator retained a reference to the now deleted collision shape, leading to a crash.
This commit is contained in:
parent
3c53aa4bb1
commit
a401c517bf
1 changed files with 3 additions and 11 deletions
|
@ -340,17 +340,9 @@ namespace MWWorld
|
||||||
|
|
||||||
if ((*iter)->getCell()->isExterior())
|
if ((*iter)->getCell()->isExterior())
|
||||||
{
|
{
|
||||||
const ESM::Land* land =
|
if (const auto heightField = mPhysics->getHeightField(cellX, cellY))
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Land>().search(
|
navigator->removeObject(DetourNavigator::ObjectId(heightField));
|
||||||
(*iter)->getCell()->getGridX(),
|
mPhysics->removeHeightField(cellX, cellY);
|
||||||
(*iter)->getCell()->getGridY()
|
|
||||||
);
|
|
||||||
if (land && land->mDataTypes&ESM::Land::DATA_VHGT)
|
|
||||||
{
|
|
||||||
if (const auto heightField = mPhysics->getHeightField(cellX, cellY))
|
|
||||||
navigator->removeObject(DetourNavigator::ObjectId(heightField));
|
|
||||||
mPhysics->removeHeightField(cellX, cellY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*iter)->getCell()->hasWater())
|
if ((*iter)->getCell()->hasWater())
|
||||||
|
|
Loading…
Reference in a new issue