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:
parent
3c53aa4bb1
commit
a401c517bf
1 changed files with 3 additions and 11 deletions
|
@ -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())
|
||||
|
|
Loading…
Reference in a new issue