Replace empty constructors with default constructors #88

This commit is contained in:
nillerusr
2022-11-05 14:22:27 +03:00
parent ba90de20d9
commit 8fbc002a37
97 changed files with 192 additions and 2620 deletions

View File

@@ -149,7 +149,7 @@ class Quaternion64
{
public:
// Construction/destruction:
Quaternion64(void) {};
Quaternion64(void) = default;
Quaternion64(vec_t X, vec_t Y, vec_t Z);
// assignment
@@ -197,7 +197,7 @@ class Quaternion48
{
public:
// Construction/destruction:
Quaternion48(void) {};
Quaternion48(void) = default;
Quaternion48(vec_t X, vec_t Y, vec_t Z);
// assignment
@@ -501,7 +501,7 @@ protected:
class float16_with_assign : public float16
{
public:
float16_with_assign() {}
float16_with_assign() = default;
float16_with_assign( float f ) { m_storage.rawWord = ConvertFloatTo16bits(f); }
float16& operator=(const float16 &other) { m_storage.rawWord = ((float16_with_assign &)other).m_storage.rawWord; return *this; }
@@ -518,7 +518,7 @@ class Vector48
{
public:
// Construction/destruction:
Vector48(void) {}
Vector48(void) = default;
Vector48(vec_t X, vec_t Y, vec_t Z) { x.SetFloat( X ); y.SetFloat( Y ); z.SetFloat( Z ); }
// assignment
@@ -562,7 +562,7 @@ class Vector2d32
{
public:
// Construction/destruction:
Vector2d32(void) {}
Vector2d32(void) = default;
Vector2d32(vec_t X, vec_t Y) { x.SetFloat( X ); y.SetFloat( Y ); }
// assignment

View File

@@ -237,7 +237,7 @@ bool R_CullBoxSkipNear( const Vector& mins, const Vector& maxs, const Frustum_t
struct matrix3x4_t
{
matrix3x4_t() {}
matrix3x4_t() = default;
matrix3x4_t(
float m00, float m01, float m02, float m03,
float m10, float m11, float m12, float m13,

File diff suppressed because it is too large Load Diff

View File

@@ -2604,9 +2604,7 @@ public:
return Vector( X(idx), Y(idx), Z(idx) );
}
FourVectors(void)
{
}
FourVectors(void) = default;
FourVectors( FourVectors const &src )
{

View File

@@ -70,7 +70,17 @@ public:
vec_t x, y, z;
// Construction/destruction:
Vector(void);
#if defined (_DEBUG) && defined (VECTOR_PARANOIA)
Vector(void)
{
// Initialize to NAN to catch errors
x = y = z = VEC_T_NAN;
}
#else
Vector(void) = default;
#endif
Vector(vec_t X, vec_t Y, vec_t Z);
explicit Vector(vec_t XYZ); ///< broadcast initialize
@@ -373,7 +383,7 @@ public:
class ALIGN16 VectorAligned : public Vector
{
public:
inline VectorAligned(void) {};
inline VectorAligned(void) = default;
inline VectorAligned(vec_t X, vec_t Y, vec_t Z)
{
Init(X,Y,Z);
@@ -497,19 +507,6 @@ float RandomVectorInUnitCircle( Vector2D *pVector );
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// constructors
//-----------------------------------------------------------------------------
inline Vector::Vector(void)
{
#ifdef _DEBUG
#ifdef VECTOR_PARANOIA
// Initialize to NAN to catch errors
x = y = z = VEC_T_NAN;
#endif
#endif
}
inline Vector::Vector(vec_t X, vec_t Y, vec_t Z)
{
x = X; y = Y; z = Z;
@@ -1542,15 +1539,16 @@ class RadianEuler;
class Quaternion // same data-layout as engine's vec4_t,
{ // which is a vec_t[4]
public:
inline Quaternion(void) {
// Initialize to NAN to catch errors
#ifdef _DEBUG
#ifdef VECTOR_PARANOIA
#if defined (_DEBUG) && defined VECTOR_PARANOIA
inline Quaternion(void)
{
// Initialize to NAN to catch errors
x = y = z = w = VEC_T_NAN;
#endif
#endif
}
#else
Quaternion(void) = default;
#endif
inline Quaternion(vec_t ix, vec_t iy, vec_t iz, vec_t iw) : x(ix), y(iy), z(iz), w(iw) { }
inline Quaternion(RadianEuler const &angle); // evil auto type promotion!!!
@@ -1624,7 +1622,7 @@ inline bool QuaternionsAreEqual( const Quaternion& src1, const Quaternion& src2,
class ALIGN16 QuaternionAligned : public Quaternion
{
public:
inline QuaternionAligned(void) {};
inline QuaternionAligned(void) = default;
inline QuaternionAligned(vec_t X, vec_t Y, vec_t Z, vec_t W)
{
Init(X,Y,Z,W);
@@ -1661,7 +1659,7 @@ class QAngle;
class RadianEuler
{
public:
inline RadianEuler(void) { }
inline RadianEuler(void) = default;
inline RadianEuler(vec_t X, vec_t Y, vec_t Z) { x = X; y = Y; z = Z; }
inline RadianEuler(Quaternion const &q); // evil auto type promotion!!!
inline RadianEuler(QAngle const &angles); // evil auto type promotion!!!
@@ -1771,7 +1769,17 @@ public:
vec_t x, y, z;
// Construction/destruction
QAngle(void);
#if defined (_DEBUG) && defined (VECTOR_PARANOIA)
inline QAngle(void)
{
// Initialize to NAN to catch errors
x = y = z = VEC_T_NAN;
}
#else
QAngle(void) = default;
#endif
QAngle(vec_t X, vec_t Y, vec_t Z);
// QAngle(RadianEuler const &angles); // evil auto type promotion!!!
@@ -1871,16 +1879,6 @@ inline void VectorMA( const QAngle &start, float scale, const QAngle &direction,
//-----------------------------------------------------------------------------
// constructors
//-----------------------------------------------------------------------------
inline QAngle::QAngle(void)
{
#ifdef _DEBUG
#ifdef VECTOR_PARANOIA
// Initialize to NAN to catch errors
x = y = z = VEC_T_NAN;
#endif
#endif
}
inline QAngle::QAngle(vec_t X, vec_t Y, vec_t Z)
{
x = X; y = Y; z = Z;

View File

@@ -36,7 +36,16 @@ public:
vec_t x, y;
// Construction/destruction
Vector2D(void);
#if defined( _DEBUG ) && defined( VECTOR_PARANOIA )
inline Vector2D(void)
{
// Initialize to NAN to catch errors
x = y = VEC_T_NAN;
}
#else
Vector2D(void) = default;
#endif
Vector2D(vec_t X, vec_t Y);
Vector2D(const float *pFloat);
@@ -194,15 +203,6 @@ void Vector2DLerp(const Vector2D& src1, const Vector2D& src2, vec_t t, Vector2D&
//-----------------------------------------------------------------------------
// constructors
//-----------------------------------------------------------------------------
inline Vector2D::Vector2D(void)
{
#ifdef _DEBUG
// Initialize to NAN to catch errors
x = y = VEC_T_NAN;
#endif
}
inline Vector2D::Vector2D(vec_t X, vec_t Y)
{
x = X; y = Y;

View File

@@ -42,7 +42,16 @@ public:
vec_t x, y, z, w;
// Construction/destruction
Vector4D(void);
#if defined( _DEBUG ) && defined( VECTOR_PARANOIA )
inline Vector4D(void)
{
// Initialize to NAN to catch errors
x = y = z = w = VEC_T_NAN;
}
#else
Vector4D(void) = default;
#endif
Vector4D(vec_t X, vec_t Y, vec_t Z, vec_t W);
Vector4D(const float *pFloat);
@@ -139,7 +148,7 @@ const Vector4D vec4_invalid( FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX );
class ALIGN16 Vector4DAligned : public Vector4D
{
public:
Vector4DAligned(void) {}
Vector4DAligned(void) = default;
Vector4DAligned( vec_t X, vec_t Y, vec_t Z, vec_t W );
inline void Set( vec_t X, vec_t Y, vec_t Z, vec_t W );
@@ -204,15 +213,6 @@ void Vector4DLerp(Vector4D const& src1, Vector4D const& src2, vec_t t, Vector4D&
//-----------------------------------------------------------------------------
// constructors
//-----------------------------------------------------------------------------
inline Vector4D::Vector4D(void)
{
#ifdef _DEBUG
// Initialize to NAN to catch errors
x = y = z = w = VEC_T_NAN;
#endif
}
inline Vector4D::Vector4D(vec_t X, vec_t Y, vec_t Z, vec_t W )
{
x = X; y = Y; z = Z; w = W;

View File

@@ -29,7 +29,7 @@ typedef int SideType;
class VPlane
{
public:
VPlane();
VPlane() = default;
VPlane(const Vector &vNormal, vec_t dist);
void Init(const Vector &vNormal, vec_t dist);
@@ -77,10 +77,6 @@ private:
//-----------------------------------------------------------------------------
// Inlines.
//-----------------------------------------------------------------------------
inline VPlane::VPlane()
{
}
inline VPlane::VPlane(const Vector &vNormal, vec_t dist)
{
m_Normal = vNormal;