1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-31 16:45:43 +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:
Evil Eye 2021-01-23 00:56:46 +01:00
parent 3c53aa4bb1
commit a401c517bf

View file

@ -340,17 +340,9 @@ namespace MWWorld
if ((*iter)->getCell()->isExterior())
{
const ESM::Land* land =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Land>().search(
(*iter)->getCell()->getGridX(),
(*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 (const auto heightField = mPhysics->getHeightField(cellX, cellY))
navigator->removeObject(DetourNavigator::ObjectId(heightField));
mPhysics->removeHeightField(cellX, cellY);
}
if ((*iter)->getCell()->hasWater())