Don't create a BulletShapeInstance for actors

coverity_scan
scrawl 9 years ago
parent 246566cef4
commit 3552b3a82c

@ -16,7 +16,7 @@ namespace MWPhysics
{ {
Actor::Actor(const MWWorld::Ptr& ptr, osg::ref_ptr<Resource::BulletShapeInstance> shape, btCollisionWorld* world) Actor::Actor(const MWWorld::Ptr& ptr, osg::ref_ptr<const Resource::BulletShape> shape, btCollisionWorld* world)
: mCanWaterWalk(false), mWalkingOnWater(false) : mCanWaterWalk(false), mWalkingOnWater(false)
, mCollisionObject(0), mForce(0.f, 0.f, 0.f), mOnGround(false) , mCollisionObject(0), mForce(0.f, 0.f, 0.f), mOnGround(false)
, mInternalCollisionMode(true) , mInternalCollisionMode(true)

@ -15,7 +15,7 @@ class btCollisionObject;
namespace Resource namespace Resource
{ {
class BulletShapeInstance; class BulletShape;
} }
namespace MWPhysics namespace MWPhysics
@ -48,7 +48,7 @@ namespace MWPhysics
class Actor : public PtrHolder class Actor : public PtrHolder
{ {
public: public:
Actor(const MWWorld::Ptr& ptr, osg::ref_ptr<Resource::BulletShapeInstance> shape, btCollisionWorld* world); Actor(const MWWorld::Ptr& ptr, osg::ref_ptr<const Resource::BulletShape> shape, btCollisionWorld* world);
~Actor(); ~Actor();
/** /**

@ -1234,11 +1234,11 @@ namespace MWPhysics
} }
void PhysicsSystem::addActor (const MWWorld::Ptr& ptr, const std::string& mesh) { void PhysicsSystem::addActor (const MWWorld::Ptr& ptr, const std::string& mesh) {
osg::ref_ptr<Resource::BulletShapeInstance> shapeInstance = mShapeManager->getInstance(mesh); osg::ref_ptr<const Resource::BulletShape> shape = mShapeManager->getShape(mesh);
if (!shapeInstance) if (!shape)
return; return;
Actor* actor = new Actor(ptr, shapeInstance, mCollisionWorld); Actor* actor = new Actor(ptr, shape, mCollisionWorld);
mActors.insert(std::make_pair(ptr, actor)); mActors.insert(std::make_pair(ptr, actor));
} }

Loading…
Cancel
Save