diff options
author | Wilson E. Alvarez <wilson.e.alvarez1@gmail.com> | 2018-12-08 15:07:33 -0500 |
---|---|---|
committer | Wilson E. Alvarez <wilson.e.alvarez1@gmail.com> | 2018-12-11 18:33:01 -0500 |
commit | 08f22f1cf0e0d133b7ea763dc3886cf462c6fcb2 (patch) | |
tree | 5f4321fb0e3150ca159598b6badcf1a90d1fdcd6 /core/math | |
parent | 41d1dba35fc851258d5aabad819d09f6a43e324c (diff) |
Moved member variables to initializer list
Diffstat (limited to 'core/math')
-rw-r--r-- | core/math/expression.cpp | 14 | ||||
-rw-r--r-- | core/math/expression.h | 4 | ||||
-rw-r--r-- | core/math/plane.h | 5 | ||||
-rw-r--r-- | core/math/quat.h | 28 |
4 files changed, 28 insertions, 23 deletions
diff --git a/core/math/expression.cpp b/core/math/expression.cpp index 0cfb54234c..7f3439e956 100644 --- a/core/math/expression.cpp +++ b/core/math/expression.cpp @@ -2157,13 +2157,13 @@ void Expression::_bind_methods() { ClassDB::bind_method(D_METHOD("get_error_text"), &Expression::get_error_text); } -Expression::Expression() { - output_type = Variant::NIL; - error_set = true; - root = NULL; - nodes = NULL; - sequenced = false; - execution_error = false; +Expression::Expression() : + output_type(Variant::NIL), + sequenced(false), + error_set(true), + root(NULL), + nodes(NULL), + execution_error(false) { } Expression::~Expression() { diff --git a/core/math/expression.h b/core/math/expression.h index ac2416d0dd..7f81542480 100644 --- a/core/math/expression.h +++ b/core/math/expression.h @@ -116,7 +116,9 @@ private: Variant::Type type; String name; - Input() { type = Variant::NIL; } + Input() : + type(Variant::NIL) { + } }; Vector<Input> inputs; diff --git a/core/math/plane.h b/core/math/plane.h index 4eedebb79e..5182dc67dd 100644 --- a/core/math/plane.h +++ b/core/math/plane.h @@ -74,10 +74,11 @@ public: _FORCE_INLINE_ bool operator!=(const Plane &p_plane) const; operator String() const; - _FORCE_INLINE_ Plane() { d = 0; } + _FORCE_INLINE_ Plane() : + d(0) {} _FORCE_INLINE_ Plane(real_t p_a, real_t p_b, real_t p_c, real_t p_d) : normal(p_a, p_b, p_c), - d(p_d){}; + d(p_d) {} _FORCE_INLINE_ Plane(const Vector3 &p_normal, real_t p_d); _FORCE_INLINE_ Plane(const Vector3 &p_point, const Vector3 &p_normal); diff --git a/core/math/quat.h b/core/math/quat.h index c4f9b3a732..59a15f460b 100644 --- a/core/math/quat.h +++ b/core/math/quat.h @@ -115,20 +115,20 @@ public: z = p_z; w = p_w; } - inline Quat(real_t p_x, real_t p_y, real_t p_z, real_t p_w) { - x = p_x; - y = p_y; - z = p_z; - w = p_w; + inline Quat(real_t p_x, real_t p_y, real_t p_z, real_t p_w) : + x(p_x), + y(p_y), + z(p_z), + w(p_w) { } Quat(const Vector3 &axis, const real_t &angle) { set_axis_angle(axis, angle); } Quat(const Vector3 &euler) { set_euler(euler); } - Quat(const Quat &q) { - x = q.x; - y = q.y; - z = q.z; - w = q.w; + Quat(const Quat &q) : + x(q.x), + y(q.y), + z(q.z), + w(q.w) { } Quat(const Vector3 &v0, const Vector3 &v1) // shortest arc @@ -153,9 +153,11 @@ public: } } - inline Quat() { - x = y = z = 0; - w = 1; + inline Quat() : + x(0), + y(0), + z(0), + w(1) { } }; |