Skip to content

Commit

Permalink
Fix crash for terrain without data, part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
scrawl committed Feb 28, 2015
1 parent 960e99c commit 2f2a95f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/openmw/mwworld/scene.cpp
Expand Up @@ -199,7 +199,7 @@ namespace MWWorld
(*iter)->getCell()->getGridX(),
(*iter)->getCell()->getGridY()
);
if (land)
if (land && land->mDataTypes&ESM::Land::DATA_VHGT)
mPhysics->removeHeightField ((*iter)->getCell()->getGridX(), (*iter)->getCell()->getGridY());
}

Expand Down
8 changes: 6 additions & 2 deletions libs/openengine/bullet/physic.cpp
Expand Up @@ -414,13 +414,17 @@ namespace Physic
+ boost::lexical_cast<std::string>(x) + "_"
+ boost::lexical_cast<std::string>(y);

HeightField hf = mHeightFieldMap [name];
HeightFieldContainer::iterator it = mHeightFieldMap.find(name);
if (it == mHeightFieldMap.end())
return;

const HeightField& hf = it->second;

mDynamicsWorld->removeRigidBody(hf.mBody);
delete hf.mShape;
delete hf.mBody;

mHeightFieldMap.erase(name);
mHeightFieldMap.erase(it);
}

void PhysicEngine::adjustRigidBody(RigidBody* body, const Ogre::Vector3 &position, const Ogre::Quaternion &rotation,
Expand Down

0 comments on commit 2f2a95f

Please sign in to comment.