diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-12 17:01:17 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 10:01:56 +0200 |
commit | 1f6f364a56319eabd02c050746fe7df3f55ffee3 (patch) | |
tree | 8bebdce946466ce8e9476ccd46c9dba62c323938 /modules/bullet/collision_object_bullet.h | |
parent | e7c9d818766a119089873e4941e4865fb36883ec (diff) | |
download | redot-engine-1f6f364a56319eabd02c050746fe7df3f55ffee3.tar.gz |
Port member initialization from constructor to declaration (C++11)
Using `clang-tidy`'s `modernize-use-default-member-init` check and
manual review of the changes, and some extra manual changes that
`clang-tidy` failed to do.
Also went manually through all of `core` to find occurrences that
`clang-tidy` couldn't handle, especially all initializations done
in a constructor without using initializer lists.
Diffstat (limited to 'modules/bullet/collision_object_bullet.h')
-rw-r--r-- | modules/bullet/collision_object_bullet.h | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/modules/bullet/collision_object_bullet.h b/modules/bullet/collision_object_bullet.h index 25176458a7..f1423a69e4 100644 --- a/modules/bullet/collision_object_bullet.h +++ b/modules/bullet/collision_object_bullet.h @@ -69,27 +69,22 @@ public: }; struct ShapeWrapper { - ShapeBullet *shape; - btCollisionShape *bt_shape; + ShapeBullet *shape = nullptr; + btCollisionShape *bt_shape = nullptr; btTransform transform; btVector3 scale; - bool active; + bool active = true; - ShapeWrapper() : - shape(nullptr), - bt_shape(nullptr), - active(true) {} + ShapeWrapper() {} ShapeWrapper(ShapeBullet *p_shape, const btTransform &p_transform, bool p_active) : shape(p_shape), - bt_shape(nullptr), active(p_active) { set_transform(p_transform); } ShapeWrapper(ShapeBullet *p_shape, const Transform &p_transform, bool p_active) : shape(p_shape), - bt_shape(nullptr), active(p_active) { set_transform(p_transform); } @@ -117,15 +112,15 @@ public: protected: Type type; ObjectID instance_id; - uint32_t collisionLayer; - uint32_t collisionMask; - bool collisionsEnabled; - bool m_isStatic; - bool ray_pickable; - btCollisionObject *bt_collision_object; - Vector3 body_scale; - bool force_shape_reset; - SpaceBullet *space; + uint32_t collisionLayer = 0; + uint32_t collisionMask = 0; + bool collisionsEnabled = true; + bool m_isStatic = false; + bool ray_pickable = false; + btCollisionObject *bt_collision_object = nullptr; + Vector3 body_scale = Vector3(1, 1, 1); + bool force_shape_reset = false; + SpaceBullet *space = nullptr; VSet<RID> exceptions; @@ -133,7 +128,7 @@ protected: /// New area is added when overlap with new area (AreaBullet::addOverlap), then is removed when it exit (CollisionObjectBullet::onExitArea) /// This array is used mainly to know which area hold the pointer of this object Vector<AreaBullet *> areasOverlapped; - bool isTransformChanged; + bool isTransformChanged = false; public: CollisionObjectBullet(Type p_type); @@ -218,11 +213,12 @@ public: class RigidCollisionObjectBullet : public CollisionObjectBullet, public ShapeOwnerBullet { protected: - btCollisionShape *mainShape; + btCollisionShape *mainShape = nullptr; Vector<ShapeWrapper> shapes; public: - RigidCollisionObjectBullet(Type p_type); + RigidCollisionObjectBullet(Type p_type) : + CollisionObjectBullet(p_type) {} ~RigidCollisionObjectBullet(); _FORCE_INLINE_ const Vector<ShapeWrapper> &get_shapes_wrappers() const { return shapes; } |