1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-25 16:43:33 +00:00

Fix BulletShape copy constructor and use for BulletShapeInstance

Copy mVisualCollisionType.
This commit is contained in:
elsid 2023-05-14 13:52:04 +02:00
parent 04d439485b
commit a8a76f9a05
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625
2 changed files with 13 additions and 16 deletions

View File

@ -71,13 +71,15 @@ namespace Resource
deleteShape(shape); deleteShape(shape);
} }
BulletShape::BulletShape(const BulletShape& copy, const osg::CopyOp& copyop) BulletShape::BulletShape(const BulletShape& other, const osg::CopyOp& copyOp)
: mCollisionShape(duplicateCollisionShape(copy.mCollisionShape.get())) : Object(other, copyOp)
, mAvoidCollisionShape(duplicateCollisionShape(copy.mAvoidCollisionShape.get())) , mCollisionShape(duplicateCollisionShape(other.mCollisionShape.get()))
, mCollisionBox(copy.mCollisionBox) , mAvoidCollisionShape(duplicateCollisionShape(other.mAvoidCollisionShape.get()))
, mAnimatedShapes(copy.mAnimatedShapes) , mCollisionBox(other.mCollisionBox)
, mFileName(copy.mFileName) , mAnimatedShapes(other.mAnimatedShapes)
, mFileHash(copy.mFileHash) , mFileName(other.mFileName)
, mFileHash(other.mFileHash)
, mVisualCollisionType(other.mVisualCollisionType)
{ {
} }
@ -94,13 +96,8 @@ namespace Resource
} }
BulletShapeInstance::BulletShapeInstance(osg::ref_ptr<const BulletShape> source) BulletShapeInstance::BulletShapeInstance(osg::ref_ptr<const BulletShape> source)
: mSource(std::move(source)) : BulletShape(*source)
, mSource(std::move(source))
{ {
mCollisionBox = mSource->mCollisionBox;
mAnimatedShapes = mSource->mAnimatedShapes;
mVisualCollisionType = mSource->mVisualCollisionType;
mCollisionShape = duplicateCollisionShape(mSource->mCollisionShape.get());
mAvoidCollisionShape = duplicateCollisionShape(mSource->mAvoidCollisionShape.get());
} }
} }

View File

@ -61,7 +61,7 @@ namespace Resource
VisualCollisionType mVisualCollisionType = VisualCollisionType::None; VisualCollisionType mVisualCollisionType = VisualCollisionType::None;
BulletShape() = default; BulletShape() = default;
BulletShape(const BulletShape& copy, const osg::CopyOp& copyop); BulletShape(const BulletShape& other, const osg::CopyOp& copyOp = osg::CopyOp());
META_Object(Resource, BulletShape) META_Object(Resource, BulletShape)
@ -76,7 +76,7 @@ namespace Resource
class BulletShapeInstance : public BulletShape class BulletShapeInstance : public BulletShape
{ {
public: public:
BulletShapeInstance(osg::ref_ptr<const BulletShape> source); explicit BulletShapeInstance(osg::ref_ptr<const BulletShape> source);
const osg::ref_ptr<const BulletShape>& getSource() const { return mSource; } const osg::ref_ptr<const BulletShape>& getSource() const { return mSource; }