From f96ca908db2d8e2a683b9c88d0cfb86b2df58ee7 Mon Sep 17 00:00:00 2001 From: s1lent Date: Wed, 14 Aug 2019 01:13:26 +0700 Subject: [PATCH] Update vector.h --- regamedll/dlls/vector.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/regamedll/dlls/vector.h b/regamedll/dlls/vector.h index eae95bf5..5de02486 100644 --- a/regamedll/dlls/vector.h +++ b/regamedll/dlls/vector.h @@ -64,12 +64,14 @@ public: decltype(auto) operator/(float fl) const { return Vector2D(x / fl, y / fl); } #endif + decltype(auto) operator=(std::nullptr_t) { return Vector2D(0, 0); } decltype(auto) operator+=(float fl) { return (*this = *this + fl); } decltype(auto) operator-=(float fl) { return (*this = *this - fl); } decltype(auto) operator*=(float fl) { return (*this = *this * fl); } decltype(auto) operator/=(float fl) { return (*this = *this / fl); } // Methods + inline void Clear() { x = 0; y = 0; } inline void CopyToArray(float *rgfl) const { *(int *)&rgfl[0] = *(int *)&x; *(int *)&rgfl[1] = *(int *)&y; } inline real_t Length() const { return Q_sqrt(real_t(x * x + y * y)); } // Get the vector's magnitude inline float LengthSquared() const { return (x * x + y * y); } // Get the vector's magnitude squared @@ -166,11 +168,20 @@ public: decltype(auto) operator/(float fl) const { return Vector(x / fl, y / fl, z / fl); } #endif + decltype(auto) operator=(std::nullptr_t) { return Vector(0, 0, 0); } decltype(auto) operator+=(float fl) { return (*this = *this + fl); } decltype(auto) operator-=(float fl) { return (*this = *this - fl); } decltype(auto) operator*=(float fl) { return (*this = *this * fl); } decltype(auto) operator/=(float fl) { return (*this = *this / fl); } + // Methods + void Clear() + { + x = 0; + y = 0; + z = 0; + } + void CopyToArray(float *rgfl) const { *(int *)&rgfl[0] = *(int *)&x;