From bc82dbbd1bb58596fa3499f415357dcf22001639 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 28 Jul 2018 16:18:51 +0400 Subject: [PATCH] Do not try to find missing animated collision shape again and again --- apps/openmw/mwphysics/physicssystem.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index e2fa7be54..ae8d76a80 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -626,7 +626,6 @@ namespace MWPhysics assert (mShapeInstance->getCollisionShape()->isCompound()); btCompoundShape* compound = static_cast(mShapeInstance->getCollisionShape()); - for (std::map::const_iterator it = mShapeInstance->mAnimatedShapes.begin(); it != mShapeInstance->mAnimatedShapes.end(); ++it) { int recIndex = it->first; @@ -640,6 +639,9 @@ namespace MWPhysics if (!visitor.mFound) { std::cerr << "Error: animateCollisionShapes can't find node " << recIndex << " for " << mPtr.getCellRef().getRefId() << std::endl; + + // Remove nonexistent nodes from animated shapes map and early out + mShapeInstance->mAnimatedShapes.erase(recIndex); return; } osg::NodePath nodePath = visitor.mFoundPath;