diff --git a/source/Entity/Checkpoint.cpp b/source/Entity/Checkpoint.cpp index 8a8cf5ef..1785d738 100644 --- a/source/Entity/Checkpoint.cpp +++ b/source/Entity/Checkpoint.cpp @@ -12,16 +12,6 @@ namespace SqMod { // ------------------------------------------------------------------------------------------------ SQMODE_DECL_TYPENAME(Typename, _SC("SqCheckpoint")) -// ------------------------------------------------------------------------------------------------ -Color4 CCheckpoint::s_Color4; -Vector3 CCheckpoint::s_Vector3; - -// ------------------------------------------------------------------------------------------------ -Int32 CCheckpoint::s_ColorR; -Int32 CCheckpoint::s_ColorG; -Int32 CCheckpoint::s_ColorB; -Int32 CCheckpoint::s_ColorA; - // ------------------------------------------------------------------------------------------------ const Int32 CCheckpoint::Max = SQMOD_CHECKPOINT_POOL; @@ -186,18 +176,17 @@ void CCheckpoint::SetWorld(Int32 world) } // ------------------------------------------------------------------------------------------------ -const Color4 & CCheckpoint::GetColor() const +Color4 CCheckpoint::GetColor() const { // Validate the managed identifier Validate(); - // Clear previous color information, if any - s_ColorR = s_ColorG = s_ColorB = s_ColorA = 0; + // Reserve some temporary floats to retrieve the color information + Int32 r, g, b, a; // Query the server for the color values - _Func->GetCheckPointColour(m_ID, &s_ColorR, &s_ColorG, &s_ColorB, &s_ColorA); - // Convert and assign the retrieved values - s_Color4.SetColor4Ex(s_ColorR, s_ColorG, s_ColorB, s_ColorA); + _Func->GetCheckPointColour(m_ID, &r, &g, &b, &a); // Return the requested information - return s_Color4; + return Color4(ConvTo< Color4::Value >::From(r), ConvTo< Color4::Value >::From(g), + ConvTo< Color4::Value >::From(b), ConvTo< Color4::Value >::From(a)); } // ------------------------------------------------------------------------------------------------ @@ -228,16 +217,16 @@ void CCheckpoint::SetColorEx(Uint8 r, Uint8 g, Uint8 b, Uint8 a) const } // ------------------------------------------------------------------------------------------------ -const Vector3 & CCheckpoint::GetPosition() const +Vector3 CCheckpoint::GetPosition() const { // Validate the managed identifier Validate(); - // Clear previous position information, if any - s_Vector3.Clear(); + // Create a default vector instance + Vector3 vec; // Query the server for the position values - _Func->GetCheckPointPosition(m_ID, &s_Vector3.x, &s_Vector3.y, &s_Vector3.z); + _Func->GetCheckPointPosition(m_ID, &vec.x, &vec.y, &vec.z); // Return the requested information - return s_Vector3; + return vec; } // ------------------------------------------------------------------------------------------------ @@ -310,11 +299,11 @@ Float32 CCheckpoint::GetPositionX() const // Validate the managed identifier Validate(); // Clear previous position information, if any - s_Vector3.x = 0; + Float32 x = 0.0f; // Query the server for the requested component value - _Func->GetCheckPointPosition(m_ID, &s_Vector3.x, nullptr, nullptr); + _Func->GetCheckPointPosition(m_ID, &x, nullptr, nullptr); // Return the requested information - return s_Vector3.x; + return x; } // ------------------------------------------------------------------------------------------------ @@ -323,11 +312,11 @@ Float32 CCheckpoint::GetPositionY() const // Validate the managed identifier Validate(); // Clear previous position information, if any - s_Vector3.y = 0; + Float32 y = 0.0f; // Query the server for the requested component value - _Func->GetCheckPointPosition(m_ID, nullptr, &s_Vector3.y, nullptr); + _Func->GetCheckPointPosition(m_ID, nullptr, &y, nullptr); // Return the requested information - return s_Vector3.y; + return y; } // ------------------------------------------------------------------------------------------------ @@ -336,11 +325,11 @@ Float32 CCheckpoint::GetPositionZ() const // Validate the managed identifier Validate(); // Clear previous position information, if any - s_Vector3.z = 0; + Float32 z = 0.0f; // Query the server for the requested component value - _Func->GetCheckPointPosition(m_ID, nullptr, nullptr, &s_Vector3.z); + _Func->GetCheckPointPosition(m_ID, nullptr, nullptr, &z); // Return the requested information - return s_Vector3.z; + return z; } // ------------------------------------------------------------------------------------------------ @@ -348,10 +337,12 @@ void CCheckpoint::SetPositionX(Float32 x) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 y, z; // Retrieve the current values for unchanged components - _Func->GetCheckPointPosition(m_ID, nullptr, &s_Vector3.y, &s_Vector3.z); + _Func->GetCheckPointPosition(m_ID, nullptr, &y, &z); // Perform the requested operation - _Func->SetCheckPointPosition(m_ID, x, s_Vector3.y, s_Vector3.z); + _Func->SetCheckPointPosition(m_ID, x, y, z); } // ------------------------------------------------------------------------------------------------ @@ -359,10 +350,12 @@ void CCheckpoint::SetPositionY(Float32 y) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, z; // Retrieve the current values for unchanged components - _Func->GetCheckPointPosition(m_ID, &s_Vector3.x, nullptr, &s_Vector3.z); + _Func->GetCheckPointPosition(m_ID, &x, nullptr, &z); // Perform the requested operation - _Func->SetCheckPointPosition(m_ID, s_Vector3.x, y, s_Vector3.z); + _Func->SetCheckPointPosition(m_ID, x, y, z); } // ------------------------------------------------------------------------------------------------ @@ -370,10 +363,12 @@ void CCheckpoint::SetPositionZ(Float32 z) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, y; // Retrieve the current values for unchanged components - _Func->GetCheckPointPosition(m_ID, &s_Vector3.x, &s_Vector3.y, nullptr); + _Func->GetCheckPointPosition(m_ID, &x, &y, nullptr); // Perform the requested operation - _Func->SetCheckPointPosition(m_ID, s_Vector3.z, s_Vector3.y, z); + _Func->SetCheckPointPosition(m_ID, z, y, z); } // ------------------------------------------------------------------------------------------------ @@ -382,11 +377,11 @@ Int32 CCheckpoint::GetColorR() const // Validate the managed identifier Validate(); // Clear previous color information, if any - s_ColorR = 0; + Int32 r = 0; // Query the server for the requested component value - _Func->GetCheckPointColour(m_ID, &s_ColorR, NULL, NULL, NULL); + _Func->GetCheckPointColour(m_ID, &r, nullptr, nullptr, nullptr); // Return the requested information - return s_ColorR; + return r; } // ------------------------------------------------------------------------------------------------ @@ -395,11 +390,11 @@ Int32 CCheckpoint::GetColorG() const // Validate the managed identifier Validate(); // Clear previous color information, if any - s_ColorG = 0; + Int32 g = 0; // Query the server for the requested component value - _Func->GetCheckPointColour(m_ID, NULL, &s_ColorG, NULL, NULL); + _Func->GetCheckPointColour(m_ID, nullptr, &g, nullptr, nullptr); // Return the requested information - return s_ColorG; + return g; } // ------------------------------------------------------------------------------------------------ @@ -408,11 +403,11 @@ Int32 CCheckpoint::GetColorB() const // Validate the managed identifier Validate(); // Clear previous color information, if any - s_ColorB = 0; + Int32 b = 0; // Query the server for the requested component value - _Func->GetCheckPointColour(m_ID, NULL, NULL, &s_ColorB, NULL); + _Func->GetCheckPointColour(m_ID, nullptr, nullptr, &b, nullptr); // Return the requested information - return s_ColorB; + return b; } // ------------------------------------------------------------------------------------------------ @@ -421,11 +416,11 @@ Int32 CCheckpoint::GetColorA() const // Validate the managed identifier Validate(); // Clear previous color information, if any - s_ColorA = 0; + Int32 a = 0; // Query the server for the requested component value - _Func->GetCheckPointColour(m_ID, NULL, NULL, NULL, &s_ColorA); + _Func->GetCheckPointColour(m_ID, nullptr, nullptr, nullptr, &a); // Return the requested information - return s_ColorA; + return a; } // ------------------------------------------------------------------------------------------------ @@ -433,10 +428,12 @@ void CCheckpoint::SetColorR(Int32 r) const { // Validate the managed identifier Validate(); + // Reserve some temporary integers to retrieve the missing components + Int32 g, b, a; // Retrieve the current values for unchanged components - _Func->GetCheckPointColour(m_ID, NULL, &s_ColorG, &s_ColorB, &s_ColorA); + _Func->GetCheckPointColour(m_ID, nullptr, &g, &b, &a); // Perform the requested operation - _Func->SetCheckPointColour(m_ID, r, s_ColorG, s_ColorB, s_ColorA); + _Func->SetCheckPointColour(m_ID, r, g, b, a); } // ------------------------------------------------------------------------------------------------ @@ -444,10 +441,12 @@ void CCheckpoint::SetColorG(Int32 g) const { // Validate the managed identifier Validate(); + // Reserve some temporary integers to retrieve the missing components + Int32 r, b, a; // Retrieve the current values for unchanged components - _Func->GetCheckPointColour(m_ID, &s_ColorR, NULL, &s_ColorB, &s_ColorA); + _Func->GetCheckPointColour(m_ID, &r, nullptr, &b, &a); // Perform the requested operation - _Func->SetCheckPointColour(m_ID, s_ColorR, g, s_ColorB, s_ColorA); + _Func->SetCheckPointColour(m_ID, r, g, b, a); } // ------------------------------------------------------------------------------------------------ @@ -455,10 +454,12 @@ void CCheckpoint::SetColorB(Int32 b) const { // Validate the managed identifier Validate(); + // Reserve some temporary integers to retrieve the missing components + Int32 r, g, a; // Retrieve the current values for unchanged components - _Func->GetCheckPointColour(m_ID, &s_ColorB, &s_ColorG, NULL, &s_ColorA); + _Func->GetCheckPointColour(m_ID, &r, &g, nullptr, &a); // Perform the requested operation - _Func->SetCheckPointColour(m_ID, s_ColorB, s_ColorG, b, s_ColorA); + _Func->SetCheckPointColour(m_ID, r, g, b, a); } // ------------------------------------------------------------------------------------------------ @@ -466,10 +467,12 @@ void CCheckpoint::SetColorA(Int32 a) const { // Validate the managed identifier Validate(); + // Reserve some temporary integers to retrieve the missing components + Int32 r, g, b; // Retrieve the current values for unchanged components - _Func->GetCheckPointColour(m_ID, &s_ColorA, &s_ColorG, &s_ColorB, NULL); + _Func->GetCheckPointColour(m_ID, &r, &g, &b, nullptr); // Perform the requested operation - _Func->SetCheckPointColour(m_ID, s_ColorA, s_ColorG, s_ColorB, a); + _Func->SetCheckPointColour(m_ID, r, g, b, a); } // ------------------------------------------------------------------------------------------------ diff --git a/source/Entity/Checkpoint.hpp b/source/Entity/Checkpoint.hpp index 0747f099..4b4d9980 100644 --- a/source/Entity/Checkpoint.hpp +++ b/source/Entity/Checkpoint.hpp @@ -26,13 +26,6 @@ class CCheckpoint private: - // -------------------------------------------------------------------------------------------- - static Color4 s_Color4; - static Vector3 s_Vector3; - - // -------------------------------------------------------------------------------------------- - static Int32 s_ColorR, s_ColorG, s_ColorB, s_ColorA; - /* -------------------------------------------------------------------------------------------- * Identifier of the managed entity. */ @@ -211,7 +204,7 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the color of the managed checkpoint entity. */ - const Color4 & GetColor() const; + Color4 GetColor() const; /* -------------------------------------------------------------------------------------------- * Modify the color of the managed checkpoint entity. @@ -231,7 +224,7 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the position of the managed checkpoint entity. */ - const Vector3 & GetPosition() const; + Vector3 GetPosition() const; /* -------------------------------------------------------------------------------------------- * Modify the position of the managed checkpoint entity. diff --git a/source/Entity/Object.cpp b/source/Entity/Object.cpp index 1ad36cb8..3975e53c 100644 --- a/source/Entity/Object.cpp +++ b/source/Entity/Object.cpp @@ -12,10 +12,6 @@ namespace SqMod { // ------------------------------------------------------------------------------------------------ SQMODE_DECL_TYPENAME(Typename, _SC("SqObject")) -// ------------------------------------------------------------------------------------------------ -Vector3 CObject::s_Vector3; -Quaternion CObject::s_Quaternion; - // ------------------------------------------------------------------------------------------------ const Int32 CObject::Max = SQMOD_OBJECT_POOL; @@ -261,16 +257,16 @@ void CObject::MoveByEx(Float32 x, Float32 y, Float32 z, Uint32 time) const } // ------------------------------------------------------------------------------------------------ -const Vector3 & CObject::GetPosition() +Vector3 CObject::GetPosition() { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.Clear(); + // Create a default vector instance + Vector3 vec; // Query the server for the values - _Func->GetObjectPosition(m_ID, &s_Vector3.x, &s_Vector3.y, &s_Vector3.z); + _Func->GetObjectPosition(m_ID, &vec.x, &vec.y, &vec.z); // Return the requested information - return s_Vector3; + return vec; } // ------------------------------------------------------------------------------------------------ @@ -364,29 +360,29 @@ void CObject::RotateByEulerEx(Float32 x, Float32 y, Float32 z, Uint32 time) cons } // ------------------------------------------------------------------------------------------------ -const Quaternion & CObject::GetRotation() +Quaternion CObject::GetRotation() { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Quaternion.Clear(); + // Create a default quaternion instance + Quaternion quat; // Query the server for the values - _Func->GetObjectRotation(m_ID, &s_Quaternion.x, &s_Quaternion.y, &s_Quaternion.z, &s_Quaternion.w); + _Func->GetObjectRotation(m_ID, &quat.x, &quat.y, &quat.z, &quat.w); // Return the requested information - return s_Quaternion; + return quat; } // ------------------------------------------------------------------------------------------------ -const Vector3 & CObject::GetRotationEuler() +Vector3 CObject::GetRotationEuler() { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.Clear(); + // Create a default vector instance + Vector3 vec; // Query the server for the values - _Func->GetObjectRotationEuler(m_ID, &s_Vector3.x, &s_Vector3.y, &s_Vector3.z); + _Func->GetObjectRotationEuler(m_ID, &vec.x, &vec.y, &vec.z); // Return the requested information - return s_Vector3; + return vec; } // ------------------------------------------------------------------------------------------------ @@ -461,11 +457,11 @@ Float32 CObject::GetPositionX() const // Validate the managed identifier Validate(); // Clear previous information, if any - s_Vector3.x = 0.0f; + Float32 x = 0.0f; // Query the server for the requested component value - _Func->GetObjectPosition(m_ID, &s_Vector3.x, nullptr, nullptr); + _Func->GetObjectPosition(m_ID, &x, nullptr, nullptr); // Return the requested information - return s_Vector3.x; + return x; } // ------------------------------------------------------------------------------------------------ @@ -474,11 +470,11 @@ Float32 CObject::GetPositionY() const // Validate the managed identifier Validate(); // Clear previous information, if any - s_Vector3.y = 0.0f; + Float32 y = 0.0f; // Query the server for the requested component value - _Func->GetObjectPosition(m_ID, nullptr, &s_Vector3.y, nullptr); + _Func->GetObjectPosition(m_ID, nullptr, &y, nullptr); // Return the requested information - return s_Vector3.y; + return y; } // ------------------------------------------------------------------------------------------------ @@ -487,11 +483,11 @@ Float32 CObject::GetPositionZ() const // Validate the managed identifier Validate(); // Clear previous information, if any - s_Vector3.z = 0.0f; + Float32 z = 0.0f; // Query the server for the requested component value - _Func->GetObjectPosition(m_ID, nullptr, nullptr, &s_Vector3.z); + _Func->GetObjectPosition(m_ID, nullptr, nullptr, &z); // Return the requested information - return s_Vector3.z; + return z; } // ------------------------------------------------------------------------------------------------ @@ -499,10 +495,12 @@ void CObject::SetPositionX(Float32 x) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 y, z; // Retrieve the current values for unchanged components - _Func->GetObjectPosition(m_ID, nullptr, &s_Vector3.y, &s_Vector3.z); + _Func->GetObjectPosition(m_ID, nullptr, &y, &z); // Perform the requested operation - _Func->SetObjectPosition(m_ID, x, s_Vector3.y, s_Vector3.z); + _Func->SetObjectPosition(m_ID, x, y, z); } // ------------------------------------------------------------------------------------------------ @@ -510,10 +508,12 @@ void CObject::SetPositionY(Float32 y) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, z; // Retrieve the current values for unchanged components - _Func->GetObjectPosition(m_ID, &s_Vector3.x, nullptr, &s_Vector3.z); + _Func->GetObjectPosition(m_ID, &x, nullptr, &z); // Perform the requested operation - _Func->SetObjectPosition(m_ID, s_Vector3.x, y, s_Vector3.z); + _Func->SetObjectPosition(m_ID, x, y, z); } // ------------------------------------------------------------------------------------------------ @@ -521,10 +521,12 @@ void CObject::SetPositionZ(Float32 z) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, y; // Retrieve the current values for unchanged components - _Func->GetObjectPosition(m_ID, &s_Vector3.x, &s_Vector3.y, nullptr); + _Func->GetObjectPosition(m_ID, &x, &y, nullptr); // Perform the requested operation - _Func->SetObjectPosition(m_ID, s_Vector3.z, s_Vector3.y, z); + _Func->SetObjectPosition(m_ID, z, y, z); } // ------------------------------------------------------------------------------------------------ @@ -533,11 +535,11 @@ Float32 CObject::GetRotationX() const // Validate the managed identifier Validate(); // Clear previous information, if any - s_Quaternion.x = 0.0f; + Float32 x = 0.0f; // Query the server for the requested component value - _Func->GetObjectRotation(m_ID, &s_Quaternion.x, nullptr, nullptr, nullptr); + _Func->GetObjectRotation(m_ID, &x, nullptr, nullptr, nullptr); // Return the requested information - return s_Quaternion.x; + return x; } // ------------------------------------------------------------------------------------------------ @@ -546,11 +548,11 @@ Float32 CObject::GetRotationY() const // Validate the managed identifier Validate(); // Clear previous information, if any - s_Quaternion.y = 0.0f; + Float32 y = 0.0f; // Query the server for the requested component value - _Func->GetObjectRotation(m_ID, nullptr, &s_Quaternion.y, nullptr, nullptr); + _Func->GetObjectRotation(m_ID, nullptr, &y, nullptr, nullptr); // Return the requested information - return s_Quaternion.y; + return y; } // ------------------------------------------------------------------------------------------------ @@ -559,11 +561,11 @@ Float32 CObject::GetRotationZ() const // Validate the managed identifier Validate(); // Clear previous information, if any - s_Quaternion.z = 0.0f; + Float32 z = 0.0f; // Query the server for the requested component value - _Func->GetObjectRotation(m_ID, nullptr, nullptr, &s_Quaternion.z, nullptr); + _Func->GetObjectRotation(m_ID, nullptr, nullptr, &z, nullptr); // Return the requested information - return s_Quaternion.z; + return z; } // ------------------------------------------------------------------------------------------------ @@ -572,11 +574,11 @@ Float32 CObject::GetRotationW() const // Validate the managed identifier Validate(); // Clear previous information, if any - s_Quaternion.w = 0.0f; + Float32 w = 0.0f; // Query the server for the requested component value - _Func->GetObjectRotation(m_ID, nullptr, nullptr, nullptr, &s_Quaternion.w); + _Func->GetObjectRotation(m_ID, nullptr, nullptr, nullptr, &w); // Return the requested information - return s_Quaternion.w; + return w; } // ------------------------------------------------------------------------------------------------ @@ -585,11 +587,11 @@ Float32 CObject::GetEulerRotationX() const // Validate the managed identifier Validate(); // Clear previous information, if any - s_Vector3.x = 0.0f; + Float32 x = 0.0f; // Query the server for the requested component value - _Func->GetObjectRotationEuler(m_ID, &s_Vector3.x, nullptr, nullptr); + _Func->GetObjectRotationEuler(m_ID, &x, nullptr, nullptr); // Return the requested information - return s_Vector3.x; + return x; } // ------------------------------------------------------------------------------------------------ @@ -598,11 +600,11 @@ Float32 CObject::GetEulerRotationY() const // Validate the managed identifier Validate(); // Clear previous information, if any - s_Vector3.y = 0.0f; + Float32 y = 0.0f; // Query the server for the requested component value - _Func->GetObjectRotationEuler(m_ID, nullptr, &s_Vector3.y, nullptr); + _Func->GetObjectRotationEuler(m_ID, nullptr, &y, nullptr); // Return the requested information - return s_Vector3.y; + return y; } // ------------------------------------------------------------------------------------------------ @@ -611,11 +613,11 @@ Float32 CObject::GetEulerRotationZ() const // Validate the managed identifier Validate(); // Clear previous information, if any - s_Vector3.z = 0.0f; + Float32 z = 0.0f; // Query the server for the requested component value - _Func->GetObjectRotationEuler(m_ID, nullptr, nullptr, &s_Vector3.z); + _Func->GetObjectRotationEuler(m_ID, nullptr, nullptr, &z); // Return the requested information - return s_Vector3.z; + return z; } // ------------------------------------------------------------------------------------------------ @@ -623,12 +625,12 @@ void CObject::MoveToX(Float32 x) const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.Clear(); + // Reserve some temporary floats to retrieve the missing components + Float32 y, z; // Retrieve the current values for unchanged components - _Func->GetObjectPosition(m_ID, nullptr, &s_Vector3.y, &s_Vector3.z); + _Func->GetObjectPosition(m_ID, nullptr, &y, &z); // Perform the requested operation - _Func->MoveObjectTo(m_ID, x, s_Vector3.y, s_Vector3.z, mMoveToDuration); + _Func->MoveObjectTo(m_ID, x, y, z, mMoveToDuration); } // ------------------------------------------------------------------------------------------------ @@ -636,12 +638,12 @@ void CObject::MoveToY(Float32 y) const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.Clear(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, z; // Retrieve the current values for unchanged components - _Func->GetObjectPosition(m_ID, &s_Vector3.x, nullptr, &s_Vector3.z); + _Func->GetObjectPosition(m_ID, &x, nullptr, &z); // Perform the requested operation - _Func->MoveObjectTo(m_ID, s_Vector3.x, y, s_Vector3.z, mMoveToDuration); + _Func->MoveObjectTo(m_ID, x, y, z, mMoveToDuration); } // ------------------------------------------------------------------------------------------------ @@ -649,12 +651,12 @@ void CObject::MoveToZ(Float32 z) const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.Clear(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, y; // Retrieve the current values for unchanged components - _Func->GetObjectPosition(m_ID, &s_Vector3.x, &s_Vector3.y, nullptr); + _Func->GetObjectPosition(m_ID, &x, &y, nullptr); // Perform the requested operation - _Func->MoveObjectTo(m_ID, s_Vector3.z, s_Vector3.y, z, mMoveToDuration); + _Func->MoveObjectTo(m_ID, z, y, z, mMoveToDuration); } // ------------------------------------------------------------------------------------------------ @@ -689,12 +691,12 @@ void CObject::RotateToX(Float32 x) const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Quaternion.Clear(); + // Reserve some temporary floats to retrieve the missing components + Float32 y, z, w; // Retrieve the current values for unchanged components - _Func->GetObjectRotation(m_ID, nullptr, &s_Quaternion.y, &s_Quaternion.z, &s_Quaternion.w); + _Func->GetObjectRotation(m_ID, nullptr, &y, &z, &w); // Perform the requested operation - _Func->RotateObjectTo(m_ID, x, s_Quaternion.y, s_Quaternion.z, s_Quaternion.w, mRotateToDuration); + _Func->RotateObjectTo(m_ID, x, y, z, w, mRotateToDuration); } // ------------------------------------------------------------------------------------------------ @@ -702,12 +704,12 @@ void CObject::RotateToY(Float32 y) const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Quaternion.Clear(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, z, w; // Retrieve the current values for unchanged components - _Func->GetObjectRotation(m_ID, &s_Quaternion.x, nullptr, &s_Quaternion.z, &s_Quaternion.w); + _Func->GetObjectRotation(m_ID, &x, nullptr, &z, &w); // Perform the requested operation - _Func->RotateObjectTo(m_ID, s_Quaternion.x, y, s_Quaternion.z, s_Quaternion.w, mRotateToDuration); + _Func->RotateObjectTo(m_ID, x, y, z, w, mRotateToDuration); } // ------------------------------------------------------------------------------------------------ @@ -715,12 +717,12 @@ void CObject::RotateToZ(Float32 z) const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Quaternion.Clear(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, y, w; // Retrieve the current values for unchanged components - _Func->GetObjectRotation(m_ID, &s_Quaternion.x, &s_Quaternion.y, nullptr, &s_Quaternion.w); + _Func->GetObjectRotation(m_ID, &x, &y, nullptr, &w); // Perform the requested operation - _Func->RotateObjectTo(m_ID, s_Quaternion.x, s_Quaternion.y, z, s_Quaternion.w, mRotateToDuration); + _Func->RotateObjectTo(m_ID, x, y, z, w, mRotateToDuration); } // ------------------------------------------------------------------------------------------------ @@ -728,12 +730,12 @@ void CObject::RotateToW(Float32 w) const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Quaternion.Clear(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, y, z; // Retrieve the current values for unchanged components - _Func->GetObjectRotation(m_ID, &s_Quaternion.x, &s_Quaternion.y, &s_Quaternion.z, nullptr); + _Func->GetObjectRotation(m_ID, &x, &y, &z, nullptr); // Perform the requested operation - _Func->RotateObjectTo(m_ID, s_Quaternion.x, s_Quaternion.y, s_Quaternion.z, w, mRotateToDuration); + _Func->RotateObjectTo(m_ID, x, y, z, w, mRotateToDuration); } // ------------------------------------------------------------------------------------------------ @@ -777,12 +779,12 @@ void CObject::RotateToEulerX(Float32 x) const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.Clear(); + // Reserve some temporary floats to retrieve the missing components + Float32 y, z; // Retrieve the current values for unchanged components - _Func->GetObjectRotationEuler(m_ID, nullptr, &s_Vector3.y, &s_Vector3.z); + _Func->GetObjectRotationEuler(m_ID, nullptr, &y, &z); // Perform the requested operation - _Func->RotateObjectToEuler(m_ID, x, s_Vector3.y, s_Vector3.z, mRotateToEulerDuration); + _Func->RotateObjectToEuler(m_ID, x, y, z, mRotateToEulerDuration); } // ------------------------------------------------------------------------------------------------ @@ -790,12 +792,12 @@ void CObject::RotateToEulerY(Float32 y) const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.Clear(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, z; // Retrieve the current values for unchanged components - _Func->GetObjectRotationEuler(m_ID, &s_Vector3.x, nullptr, &s_Vector3.z); + _Func->GetObjectRotationEuler(m_ID, &x, nullptr, &z); // Perform the requested operation - _Func->RotateObjectToEuler(m_ID, s_Vector3.x, y, s_Vector3.z, mRotateToEulerDuration); + _Func->RotateObjectToEuler(m_ID, x, y, z, mRotateToEulerDuration); } // ------------------------------------------------------------------------------------------------ @@ -803,12 +805,12 @@ void CObject::RotateToEulerZ(Float32 z) const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.Clear(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, y; // Retrieve the current values for unchanged components - _Func->GetObjectRotationEuler(m_ID, &s_Vector3.x, &s_Vector3.y, nullptr); + _Func->GetObjectRotationEuler(m_ID, &x, &y, nullptr); // Perform the requested operation - _Func->RotateObjectToEuler(m_ID, s_Vector3.z, s_Vector3.y, z, mRotateToEulerDuration); + _Func->RotateObjectToEuler(m_ID, z, y, z, mRotateToEulerDuration); } // ------------------------------------------------------------------------------------------------ diff --git a/source/Entity/Object.hpp b/source/Entity/Object.hpp index cc3b11c8..0e91487d 100644 --- a/source/Entity/Object.hpp +++ b/source/Entity/Object.hpp @@ -27,10 +27,6 @@ class CObject private: - // -------------------------------------------------------------------------------------------- - static Vector3 s_Vector3; - static Quaternion s_Quaternion; - /* -------------------------------------------------------------------------------------------- * Identifier of the managed entity. */ @@ -262,7 +258,7 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the position of the managed object entity. */ - const Vector3 & GetPosition(); + Vector3 GetPosition(); /* -------------------------------------------------------------------------------------------- * Modify the position of the managed object entity. @@ -317,12 +313,12 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the rotation of the managed object entity. */ - const Quaternion & GetRotation(); + Quaternion GetRotation(); /* -------------------------------------------------------------------------------------------- * Retrieve the Euler rotation of the managed object entity. */ - const Vector3 & GetRotationEuler(); + Vector3 GetRotationEuler(); /* -------------------------------------------------------------------------------------------- * See whether the managed object entity reports gunshots. @@ -512,4 +508,4 @@ public: } // Namespace:: SqMod -#endif // _ENTITY_OBJECT_HPP_ \ No newline at end of file +#endif // _ENTITY_OBJECT_HPP_ diff --git a/source/Entity/Pickup.cpp b/source/Entity/Pickup.cpp index 9acbe125..d48f6786 100644 --- a/source/Entity/Pickup.cpp +++ b/source/Entity/Pickup.cpp @@ -11,9 +11,6 @@ namespace SqMod { // ------------------------------------------------------------------------------------------------ SQMODE_DECL_TYPENAME(Typename, _SC("SqPickup")) -// ------------------------------------------------------------------------------------------------ -Vector3 CPickup::s_Vector3; - // ------------------------------------------------------------------------------------------------ const Int32 CPickup::Max = SQMOD_PICKUP_POOL; @@ -277,16 +274,16 @@ void CPickup::Refresh() const } // ------------------------------------------------------------------------------------------------ -const Vector3 & CPickup::GetPosition() +Vector3 CPickup::GetPosition() { // Validate the managed identifier Validate(); - // Clear previous position information, if any - s_Vector3.Clear(); + // Create a default vector instance + Vector3 vec; // Query the server for the position values - _Func->GetPickupPosition(m_ID, &s_Vector3.x, &s_Vector3.y, &s_Vector3.z); + _Func->GetPickupPosition(m_ID, &vec.x, &vec.y, &vec.z); // Return the requested information - return s_Vector3; + return vec; } // ------------------------------------------------------------------------------------------------ @@ -331,11 +328,11 @@ Float32 CPickup::GetPositionX() const // Validate the managed identifier Validate(); // Clear previous position information, if any - s_Vector3.x = 0; + Float32 x = 0.0f; // Query the server for the requested component value - _Func->GetPickupPosition(m_ID, &s_Vector3.x, NULL, NULL); + _Func->GetPickupPosition(m_ID, &x, nullptr, nullptr); // Return the requested information - return s_Vector3.x; + return x; } // ------------------------------------------------------------------------------------------------ @@ -344,11 +341,11 @@ Float32 CPickup::GetPositionY() const // Validate the managed identifier Validate(); // Clear previous position information, if any - s_Vector3.y = 0; + Float32 y = 0.0f; // Query the server for the requested component value - _Func->GetPickupPosition(m_ID, NULL, &s_Vector3.y, NULL); + _Func->GetPickupPosition(m_ID, nullptr, &y, nullptr); // Return the requested information - return s_Vector3.y; + return y; } // ------------------------------------------------------------------------------------------------ @@ -357,11 +354,11 @@ Float32 CPickup::GetPositionZ() const // Validate the managed identifier Validate(); // Clear previous position information, if any - s_Vector3.z = 0; + Float32 z = 0.0f; // Query the server for the requested component value - _Func->GetPickupPosition(m_ID, NULL, NULL, &s_Vector3.z); + _Func->GetPickupPosition(m_ID, nullptr, nullptr, &z); // Return the requested information - return s_Vector3.z; + return z; } // ------------------------------------------------------------------------------------------------ @@ -369,10 +366,12 @@ void CPickup::SetPositionX(Float32 x) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 y, z; // Retrieve the current values for unchanged components - _Func->GetPickupPosition(m_ID, NULL, &s_Vector3.y, &s_Vector3.z); + _Func->GetPickupPosition(m_ID, nullptr, &y, &z); // Perform the requested operation - _Func->SetPickupPosition(m_ID, x, s_Vector3.y, s_Vector3.z); + _Func->SetPickupPosition(m_ID, x, y, z); } // ------------------------------------------------------------------------------------------------ @@ -380,10 +379,12 @@ void CPickup::SetPositionY(Float32 y) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, z; // Retrieve the current values for unchanged components - _Func->GetPickupPosition(m_ID, &s_Vector3.x, NULL, &s_Vector3.z); + _Func->GetPickupPosition(m_ID, &x, nullptr, &z); // Perform the requested operation - _Func->SetPickupPosition(m_ID, s_Vector3.x, y, s_Vector3.z); + _Func->SetPickupPosition(m_ID, x, y, z); } // ------------------------------------------------------------------------------------------------ @@ -391,10 +392,12 @@ void CPickup::SetPositionZ(Float32 z) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, y; // Retrieve the current values for unchanged components - _Func->GetPickupPosition(m_ID, &s_Vector3.x, &s_Vector3.y, NULL); + _Func->GetPickupPosition(m_ID, &x, &y, nullptr); // Perform the requested operation - _Func->SetPickupPosition(m_ID, s_Vector3.z, s_Vector3.y, z); + _Func->SetPickupPosition(m_ID, z, y, z); } // ------------------------------------------------------------------------------------------------ diff --git a/source/Entity/Pickup.hpp b/source/Entity/Pickup.hpp index c68bc102..cae5952e 100644 --- a/source/Entity/Pickup.hpp +++ b/source/Entity/Pickup.hpp @@ -28,9 +28,6 @@ class CPickup private: - // -------------------------------------------------------------------------------------------- - static Vector3 s_Vector3; - /* -------------------------------------------------------------------------------------------- * Identifier of the managed entity. */ @@ -239,7 +236,7 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the position of the managed pickup entity. */ - const Vector3 & GetPosition(); + Vector3 GetPosition(); /* -------------------------------------------------------------------------------------------- * Mpdify the position of the managed pickup entity. diff --git a/source/Entity/Player.cpp b/source/Entity/Player.cpp index a7456e9a..8bf3707d 100644 --- a/source/Entity/Player.cpp +++ b/source/Entity/Player.cpp @@ -24,10 +24,6 @@ extern SQRESULT SqGrabPlayerMessageColor(HSQUIRRELVM vm, Int32 idx, Uint32 & col // ------------------------------------------------------------------------------------------------ SQMODE_DECL_TYPENAME(Typename, _SC("SqPlayer")) -// ------------------------------------------------------------------------------------------------ -Color3 CPlayer::s_Color3; -Vector3 CPlayer::s_Vector3; - // ------------------------------------------------------------------------------------------------ SQChar CPlayer::s_Buffer[SQMOD_PLAYER_TMP_BUFFER]; @@ -562,16 +558,16 @@ void CPlayer::SetSkin(Int32 skin) } // ------------------------------------------------------------------------------------------------ -const Color3 & CPlayer::GetColor() const +Color3 CPlayer::GetColor() const { // Validate the managed identifier Validate(); - // Clear previous color information, if any - s_Color3.Clear(); + // Create an empty color + Color3 color; // Query the server for the color values - s_Color3.SetRGB(_Func->GetPlayerColour(m_ID)); + color.SetRGB(_Func->GetPlayerColour(m_ID)); // Return the requested information - return s_Color3; + return color; } // ------------------------------------------------------------------------------------------------ @@ -829,16 +825,16 @@ void CPlayer::SetImmunity(Int32 flags) } // ------------------------------------------------------------------------------------------------ -const Vector3 & CPlayer::GetPosition() const +Vector3 CPlayer::GetPosition() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.Clear(); + // Create a default vector instance + Vector3 vec; // Query the server for the values - _Func->GetPlayerPosition(m_ID, &s_Vector3.x, &s_Vector3.y, &s_Vector3.z); + _Func->GetPlayerPosition(m_ID, &vec.x, &vec.y, &vec.z); // Return the requested information - return s_Vector3; + return vec; } // ------------------------------------------------------------------------------------------------ @@ -860,16 +856,16 @@ void CPlayer::SetPositionEx(Float32 x, Float32 y, Float32 z) const } // ------------------------------------------------------------------------------------------------ -const Vector3 & CPlayer::GetSpeed() const +Vector3 CPlayer::GetSpeed() const { // Validate the managed identifier Validate(); - // Clear previous speed information, if any - s_Vector3.Clear(); + // Create a default vector instance + Vector3 vec; // Query the server for the speed values - _Func->GetPlayerSpeed(m_ID, &s_Vector3.x, &s_Vector3.y, &s_Vector3.z); + _Func->GetPlayerSpeed(m_ID, &vec.x, &vec.y, &vec.z); // Return the requested information - return s_Vector3; + return vec; } // ------------------------------------------------------------------------------------------------ @@ -966,29 +962,29 @@ void CPlayer::SetAlphaEx(Int32 alpha, Int32 fade) } // ------------------------------------------------------------------------------------------------ -const Vector3 & CPlayer::GetAimPosition() const +Vector3 CPlayer::GetAimPosition() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.Clear(); + // Create a default vector instance + Vector3 vec; // Query the server for the values - _Func->GetPlayerAimPosition(m_ID, &s_Vector3.x, &s_Vector3.y, &s_Vector3.z); + _Func->GetPlayerAimPosition(m_ID, &vec.x, &vec.y, &vec.z); // Return the requested information - return s_Vector3; + return vec; } // ------------------------------------------------------------------------------------------------ -const Vector3 & CPlayer::GetAimDirection() const +Vector3 CPlayer::GetAimDirection() const { // Validate the managed identifier Validate(); - // Clear previous direction information, if any - s_Vector3.Clear(); + // Create a default vector instance + Vector3 vec; // Query the server for the direction values - _Func->GetPlayerAimDirection(m_ID, &s_Vector3.x, &s_Vector3.y, &s_Vector3.z); + _Func->GetPlayerAimDirection(m_ID, &vec.x, &vec.y, &vec.z); // Return the requested information - return s_Vector3; + return vec; } // ------------------------------------------------------------------------------------------------ @@ -1820,12 +1816,12 @@ Float32 CPlayer::GetPositionX() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.x = 0; + // Reserve a temporary float to retrieve the requested component + Float32 x = 0.0f; // Query the server for the requested component value - _Func->GetPlayerPosition(m_ID, &s_Vector3.x, nullptr, nullptr); + _Func->GetPlayerPosition(m_ID, &x, nullptr, nullptr); // Return the requested information - return s_Vector3.x; + return x; } // ------------------------------------------------------------------------------------------------ @@ -1833,12 +1829,12 @@ Float32 CPlayer::GetPositionY() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.y = 0; + // Reserve a temporary float to retrieve the requested component + Float32 y = 0.0f; // Query the server for the requested component value - _Func->GetPlayerPosition(m_ID, nullptr, &s_Vector3.y, nullptr); + _Func->GetPlayerPosition(m_ID, nullptr, &y, nullptr); // Return the requested information - return s_Vector3.y; + return y; } // ------------------------------------------------------------------------------------------------ @@ -1846,12 +1842,12 @@ Float32 CPlayer::GetPositionZ() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.z = 0; + // Reserve a temporary float to retrieve the requested component + Float32 z = 0.0f; // Query the server for the requested component value - _Func->GetPlayerPosition(m_ID, nullptr, nullptr, &s_Vector3.z); + _Func->GetPlayerPosition(m_ID, nullptr, nullptr, &z); // Return the requested information - return s_Vector3.z; + return z; } // ------------------------------------------------------------------------------------------------ @@ -1859,10 +1855,12 @@ void CPlayer::SetPositionX(Float32 x) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 y, z; // Retrieve the current values for unchanged components - _Func->GetPlayerPosition(m_ID, nullptr, &s_Vector3.y, &s_Vector3.z); + _Func->GetPlayerPosition(m_ID, nullptr, &y, &z); // Perform the requested operation - _Func->SetPlayerPosition(m_ID, x, s_Vector3.y, s_Vector3.z); + _Func->SetPlayerPosition(m_ID, x, y, z); } // ------------------------------------------------------------------------------------------------ @@ -1870,10 +1868,12 @@ void CPlayer::SetPositionY(Float32 y) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, z; // Retrieve the current values for unchanged components - _Func->GetPlayerPosition(m_ID, &s_Vector3.x, nullptr, &s_Vector3.z); + _Func->GetPlayerPosition(m_ID, &x, nullptr, &z); // Perform the requested operation - _Func->SetPlayerPosition(m_ID, s_Vector3.x, y, s_Vector3.z); + _Func->SetPlayerPosition(m_ID, x, y, z); } // ------------------------------------------------------------------------------------------------ @@ -1881,10 +1881,12 @@ void CPlayer::SetPositionZ(Float32 z) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, y; // Retrieve the current values for unchanged components - _Func->GetPlayerPosition(m_ID, &s_Vector3.x, &s_Vector3.y, nullptr); + _Func->GetPlayerPosition(m_ID, &x, &y, nullptr); // Perform the requested operation - _Func->SetPlayerPosition(m_ID, s_Vector3.z, s_Vector3.y, z); + _Func->SetPlayerPosition(m_ID, z, y, z); } // ------------------------------------------------------------------------------------------------ diff --git a/source/Entity/Player.hpp b/source/Entity/Player.hpp index 56a4e074..885a8473 100644 --- a/source/Entity/Player.hpp +++ b/source/Entity/Player.hpp @@ -35,10 +35,6 @@ class CPlayer private: - // -------------------------------------------------------------------------------------------- - static Color3 s_Color3; - static Vector3 s_Vector3; - // -------------------------------------------------------------------------------------------- static SQChar s_Buffer[SQMOD_PLAYER_TMP_BUFFER]; @@ -382,7 +378,7 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the color of the managed player entity. */ - const Color3 & GetColor() const; + Color3 GetColor() const; /* -------------------------------------------------------------------------------------------- * Modify the color of the managed player entity. @@ -492,7 +488,7 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the position of the managed player entity. */ - const Vector3 & GetPosition() const; + Vector3 GetPosition() const; /* -------------------------------------------------------------------------------------------- * Modify the position of the managed player entity. @@ -507,7 +503,7 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the speed of the managed player entity. */ - const Vector3 & GetSpeed() const; + Vector3 GetSpeed() const; /* -------------------------------------------------------------------------------------------- * Modify the speed of the managed player entity. @@ -557,12 +553,12 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the aim position of the managed player entity. */ - const Vector3 & GetAimPosition() const; + Vector3 GetAimPosition() const; /* -------------------------------------------------------------------------------------------- * Retrieve the aim direction of the managed player entity. */ - const Vector3 & GetAimDirection() const; + Vector3 GetAimDirection() const; /* -------------------------------------------------------------------------------------------- * See whether the managed player entity is burning. diff --git a/source/Entity/Vehicle.cpp b/source/Entity/Vehicle.cpp index af1b7cba..2a86d8f9 100644 --- a/source/Entity/Vehicle.cpp +++ b/source/Entity/Vehicle.cpp @@ -14,11 +14,6 @@ namespace SqMod { // ------------------------------------------------------------------------------------------------ SQMODE_DECL_TYPENAME(Typename, _SC("SqVehicle")) -// ------------------------------------------------------------------------------------------------ -Vector2 CVehicle::s_Vector2; -Vector3 CVehicle::s_Vector3; -Quaternion CVehicle::s_Quaternion; - // ------------------------------------------------------------------------------------------------ const Int32 CVehicle::Max = SQMOD_VEHICLE_POOL; @@ -348,16 +343,16 @@ bool CVehicle::IsWrecked() const } // ------------------------------------------------------------------------------------------------ -const Vector3 & CVehicle::GetPosition() const +Vector3 CVehicle::GetPosition() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.Clear(); + // Create a default vector instance + Vector3 vec; // Query the server for the values - _Func->GetVehiclePosition(m_ID, &s_Vector3.x, &s_Vector3.y, &s_Vector3.z); + _Func->GetVehiclePosition(m_ID, &vec.x, &vec.y, &vec.z); // Return the requested information - return s_Vector3; + return vec; } // ------------------------------------------------------------------------------------------------ @@ -397,16 +392,16 @@ void CVehicle::SetPositionEx(Float32 x, Float32 y, Float32 z, bool empty) const } // ------------------------------------------------------------------------------------------------ -const Quaternion & CVehicle::GetRotation() const +Quaternion CVehicle::GetRotation() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Quaternion.Clear(); + // Create a default quaternion instance + Quaternion quat; // Query the server for the values - _Func->GetVehicleRotation(m_ID, &s_Quaternion.x, &s_Quaternion.y, &s_Quaternion.z, &s_Quaternion.w); + _Func->GetVehicleRotation(m_ID, &quat.x, &quat.y, &quat.z, &quat.w); // Return the requested information - return s_Quaternion; + return quat; } // ------------------------------------------------------------------------------------------------ @@ -428,16 +423,16 @@ void CVehicle::SetRotationEx(Float32 x, Float32 y, Float32 z, Float32 w) const } // ------------------------------------------------------------------------------------------------ -const Vector3 & CVehicle::GetRotationEuler() const +Vector3 CVehicle::GetRotationEuler() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.Clear(); + // Create a default vector instance + Vector3 vec; // Query the server for the values - _Func->GetVehicleRotationEuler(m_ID, &s_Vector3.x, &s_Vector3.y, &s_Vector3.z); + _Func->GetVehicleRotationEuler(m_ID, &vec.x, &vec.y, &vec.z); // Return the requested information - return s_Vector3; + return vec; } // ------------------------------------------------------------------------------------------------ @@ -459,16 +454,16 @@ void CVehicle::SetRotationEulerEx(Float32 x, Float32 y, Float32 z) const } // ------------------------------------------------------------------------------------------------ -const Vector3 & CVehicle::GetSpeed() const +Vector3 CVehicle::GetSpeed() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.Clear(); + // Create a default vector instance + Vector3 vec; // Query the server for the values - _Func->GetVehicleSpeed(m_ID, &s_Vector3.x, &s_Vector3.y, &s_Vector3.z, false); + _Func->GetVehicleSpeed(m_ID, &vec.x, &vec.y, &vec.z, false); // Return the requested information - return s_Vector3; + return vec; } // ------------------------------------------------------------------------------------------------ @@ -508,16 +503,16 @@ void CVehicle::AddSpeedEx(Float32 x, Float32 y, Float32 z) const } // ------------------------------------------------------------------------------------------------ -const Vector3 & CVehicle::GetRelativeSpeed() const +Vector3 CVehicle::GetRelativeSpeed() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.Clear(); + // Create a default vector instance + Vector3 vec; // Query the server for the values - _Func->GetVehicleSpeed(m_ID, &s_Vector3.x, &s_Vector3.y, &s_Vector3.z, true); + _Func->GetVehicleSpeed(m_ID, &vec.x, &vec.y, &vec.z, true); // Return the requested information - return s_Vector3; + return vec; } // ------------------------------------------------------------------------------------------------ @@ -557,16 +552,16 @@ void CVehicle::AddRelativeSpeedEx(Float32 x, Float32 y, Float32 z) const } // ------------------------------------------------------------------------------------------------ -const Vector3 & CVehicle::GetTurnSpeed() const +Vector3 CVehicle::GetTurnSpeed() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.Clear(); + // Create a default vector instance + Vector3 vec; // Query the server for the values - _Func->GetVehicleTurnSpeed(m_ID, &s_Vector3.x, &s_Vector3.y, &s_Vector3.z, false); + _Func->GetVehicleTurnSpeed(m_ID, &vec.x, &vec.y, &vec.z, false); // Return the requested information - return s_Vector3; + return vec; } // ------------------------------------------------------------------------------------------------ @@ -606,16 +601,16 @@ void CVehicle::AddTurnSpeedEx(Float32 x, Float32 y, Float32 z) const } // ------------------------------------------------------------------------------------------------ -const Vector3 & CVehicle::GetRelativeTurnSpeed() const +Vector3 CVehicle::GetRelativeTurnSpeed() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.Clear(); + // Create a default vector instance + Vector3 vec; // Query the server for the values - _Func->GetVehicleTurnSpeed(m_ID, &s_Vector3.x, &s_Vector3.y, &s_Vector3.z, true); + _Func->GetVehicleTurnSpeed(m_ID, &vec.x, &vec.y, &vec.z, true); // Return the requested information - return s_Vector3; + return vec; } // ------------------------------------------------------------------------------------------------ @@ -655,16 +650,16 @@ void CVehicle::AddRelativeTurnSpeedEx(Float32 x, Float32 y, Float32 z) const } // ------------------------------------------------------------------------------------------------ -const Vector3 & CVehicle::GetSpawnPosition() const +Vector3 CVehicle::GetSpawnPosition() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.Clear(); + // Create a default vector instance + Vector3 vec; // Query the server for the values - _Func->GetVehicleSpawnPosition(m_ID, &s_Vector3.x, &s_Vector3.y, &s_Vector3.z); + _Func->GetVehicleSpawnPosition(m_ID, &vec.x, &vec.y, &vec.z); // Return the requested information - return s_Vector3; + return vec; } // ------------------------------------------------------------------------------------------------ @@ -686,16 +681,16 @@ void CVehicle::SetSpawnPositionEx(Float32 x, Float32 y, Float32 z) const } // ------------------------------------------------------------------------------------------------ -const Quaternion & CVehicle::GetSpawnRotation() const +Quaternion CVehicle::GetSpawnRotation() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Quaternion.Clear(); + // Create a default quaternion instance + Quaternion quat; // Query the server for the values - _Func->GetVehicleSpawnRotation(m_ID, &s_Quaternion.x, &s_Quaternion.y, &s_Quaternion.z, &s_Quaternion.w); + _Func->GetVehicleSpawnRotation(m_ID, &quat.x, &quat.y, &quat.z, &quat.w); // Return the requested information - return s_Quaternion; + return quat; } // ------------------------------------------------------------------------------------------------ @@ -717,16 +712,16 @@ void CVehicle::SetSpawnRotationEx(Float32 x, Float32 y, Float32 z, Float32 w) co } // ------------------------------------------------------------------------------------------------ -const Vector3 & CVehicle::GetSpawnRotationEuler() const +Vector3 CVehicle::GetSpawnRotationEuler() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.Clear(); + // Create a default vector instance + Vector3 vec; // Query the server for the rotation values - _Func->GetVehicleSpawnRotationEuler(m_ID, &s_Vector3.x, &s_Vector3.y, &s_Vector3.z); + _Func->GetVehicleSpawnRotationEuler(m_ID, &vec.x, &vec.y, &vec.z); // Return the requested information - return s_Vector3; + return vec; } // ------------------------------------------------------------------------------------------------ @@ -987,16 +982,16 @@ void CVehicle::SetRadio(Int32 radio) } // ------------------------------------------------------------------------------------------------ -const Vector2 & CVehicle::GetTurretRotation() const +Vector2 CVehicle::GetTurretRotation() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector2.Clear(); + // Create a default vector instance + Vector2 vec; // Query the server for the values - _Func->GetVehicleTurretRotation(m_ID, &s_Vector2.x, &s_Vector2.y); + _Func->GetVehicleTurretRotation(m_ID, &vec.x, &vec.y); // Return the requested information - return s_Vector2; + return vec; } // ------------------------------------------------------------------------------------------------ @@ -1283,12 +1278,12 @@ Float32 CVehicle::GetPositionX() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.x = 0; + // Reserve a temporary float to retrieve the requested component + Float32 x = 0.0f; // Query the server for the requested component value - _Func->GetVehiclePosition(m_ID, &s_Vector3.x, nullptr, nullptr); + _Func->GetVehiclePosition(m_ID, &x, nullptr, nullptr); // Return the requested information - return s_Vector3.x; + return x; } // ------------------------------------------------------------------------------------------------ @@ -1296,12 +1291,12 @@ Float32 CVehicle::GetPositionY() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.y = 0; + // Reserve a temporary float to retrieve the requested component + Float32 y = 0.0f; // Query the server for the requested component value - _Func->GetVehiclePosition(m_ID, nullptr, &s_Vector3.y, nullptr); + _Func->GetVehiclePosition(m_ID, nullptr, &y, nullptr); // Return the requested information - return s_Vector3.y; + return y; } // ------------------------------------------------------------------------------------------------ @@ -1309,12 +1304,12 @@ Float32 CVehicle::GetPositionZ() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.z = 0; + // Reserve a temporary float to retrieve the requested component + Float32 z = 0.0f; // Query the server for the requested component value - _Func->GetVehiclePosition(m_ID, nullptr, nullptr, &s_Vector3.z); + _Func->GetVehiclePosition(m_ID, nullptr, nullptr, &z); // Return the requested information - return s_Vector3.z; + return z; } // ------------------------------------------------------------------------------------------------ @@ -1322,10 +1317,12 @@ void CVehicle::SetPositionX(Float32 x) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 y, z; // Retrieve the current values for unchanged components - _Func->GetVehiclePosition(m_ID, nullptr, &s_Vector3.y, &s_Vector3.z); + _Func->GetVehiclePosition(m_ID, nullptr, &y, &z); // Perform the requested operation - _Func->SetVehiclePosition(m_ID, x, s_Vector3.y, s_Vector3.z, false); + _Func->SetVehiclePosition(m_ID, x, y, z, false); } // ------------------------------------------------------------------------------------------------ @@ -1333,10 +1330,12 @@ void CVehicle::SetPositionY(Float32 y) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, z; // Retrieve the current values for unchanged components - _Func->GetVehiclePosition(m_ID, &s_Vector3.x, nullptr, &s_Vector3.z); + _Func->GetVehiclePosition(m_ID, &x, nullptr, &z); // Perform the requested operation - _Func->SetVehiclePosition(m_ID, s_Vector3.x, y, s_Vector3.z, false); + _Func->SetVehiclePosition(m_ID, x, y, z, false); } // ------------------------------------------------------------------------------------------------ @@ -1344,10 +1343,12 @@ void CVehicle::SetPositionZ(Float32 z) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, y; // Retrieve the current values for unchanged components - _Func->GetVehiclePosition(m_ID, &s_Vector3.x, &s_Vector3.y, nullptr); + _Func->GetVehiclePosition(m_ID, &x, &y, nullptr); // Perform the requested operation - _Func->SetVehiclePosition(m_ID, s_Vector3.z, s_Vector3.y, z, false); + _Func->SetVehiclePosition(m_ID, z, y, z, false); } // ------------------------------------------------------------------------------------------------ @@ -1355,12 +1356,12 @@ Float32 CVehicle::GetRotationX() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Quaternion.x = 0; + // Reserve a temporary float to retrieve the requested component + Float32 x = 0.0f; // Query the server for the requested component value - _Func->GetVehicleRotation(m_ID, &s_Quaternion.x, nullptr, nullptr, nullptr); + _Func->GetVehicleRotation(m_ID, &x, nullptr, nullptr, nullptr); // Return the requested information - return s_Quaternion.x; + return x; } // ------------------------------------------------------------------------------------------------ @@ -1368,12 +1369,12 @@ Float32 CVehicle::GetRotationY() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Quaternion.y = 0; + // Reserve a temporary float to retrieve the requested component + Float32 y = 0.0f; // Query the server for the requested component value - _Func->GetVehicleRotation(m_ID, nullptr, &s_Quaternion.y, nullptr, nullptr); + _Func->GetVehicleRotation(m_ID, nullptr, &y, nullptr, nullptr); // Return the requested information - return s_Quaternion.y; + return y; } // ------------------------------------------------------------------------------------------------ @@ -1381,12 +1382,12 @@ Float32 CVehicle::GetRotationZ() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Quaternion.z = 0; + // Reserve a temporary float to retrieve the requested component + Float32 z = 0.0f; // Query the server for the requested component value - _Func->GetVehicleRotation(m_ID, nullptr, nullptr, &s_Quaternion.z, nullptr); + _Func->GetVehicleRotation(m_ID, nullptr, nullptr, &z, nullptr); // Return the requested information - return s_Quaternion.z; + return z; } // ------------------------------------------------------------------------------------------------ @@ -1394,12 +1395,12 @@ Float32 CVehicle::GetRotationW() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Quaternion.w = 0; + // Reserve a temporary float to retrieve the requested component + Float32 w = 0.0f; // Query the server for the requested component value - _Func->GetVehicleRotation(m_ID, nullptr, nullptr, nullptr, &s_Quaternion.w); + _Func->GetVehicleRotation(m_ID, nullptr, nullptr, nullptr, &w); // Return the requested information - return s_Quaternion.w; + return w; } // ------------------------------------------------------------------------------------------------ @@ -1407,10 +1408,12 @@ void CVehicle::SetRotationX(Float32 x) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 y, z, w; // Retrieve the current values for unchanged components - _Func->GetVehicleRotation(m_ID, nullptr, &s_Quaternion.y, &s_Quaternion.z, &s_Quaternion.w); + _Func->GetVehicleRotation(m_ID, nullptr, &y, &z, &w); // Perform the requested operation - _Func->SetVehicleRotation(m_ID, x, s_Quaternion.y, s_Quaternion.z, s_Quaternion.w); + _Func->SetVehicleRotation(m_ID, x, y, z, w); } // ------------------------------------------------------------------------------------------------ @@ -1418,10 +1421,12 @@ void CVehicle::SetRotationY(Float32 y) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, z, w; // Retrieve the current values for unchanged components - _Func->GetVehicleRotation(m_ID, &s_Quaternion.x, nullptr, &s_Quaternion.z, &s_Quaternion.w); + _Func->GetVehicleRotation(m_ID, &x, nullptr, &z, &w); // Perform the requested operation - _Func->SetVehicleRotation(m_ID, s_Quaternion.x, y, s_Quaternion.z, s_Quaternion.w); + _Func->SetVehicleRotation(m_ID, x, y, z, w); } // ------------------------------------------------------------------------------------------------ @@ -1429,10 +1434,12 @@ void CVehicle::SetRotationZ(Float32 z) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, y, w; // Retrieve the current values for unchanged components - _Func->GetVehicleRotation(m_ID, &s_Quaternion.x, &s_Quaternion.y, nullptr, &s_Quaternion.w); + _Func->GetVehicleRotation(m_ID, &x, &y, nullptr, &w); // Perform the requested operation - _Func->SetVehicleRotation(m_ID, s_Quaternion.x, s_Quaternion.y, z, s_Quaternion.w); + _Func->SetVehicleRotation(m_ID, x, y, z, w); } // ------------------------------------------------------------------------------------------------ @@ -1440,10 +1447,12 @@ void CVehicle::SetRotationW(Float32 w) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, y, z; // Retrieve the current values for unchanged components - _Func->GetVehicleRotation(m_ID, &s_Quaternion.x, &s_Quaternion.y, &s_Quaternion.z, nullptr); + _Func->GetVehicleRotation(m_ID, &x, &y, &z, nullptr); // Perform the requested operation - _Func->SetVehicleRotation(m_ID, s_Quaternion.x, s_Quaternion.y, s_Quaternion.z, w); + _Func->SetVehicleRotation(m_ID, x, y, z, w); } @@ -1452,12 +1461,12 @@ Float32 CVehicle::GetEulerRotationX() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.x = 0; + // Reserve a temporary float to retrieve the requested component + Float32 x = 0.0f; // Query the server for the requested component value - _Func->GetVehicleRotationEuler(m_ID, &s_Vector3.x, nullptr, nullptr); + _Func->GetVehicleRotationEuler(m_ID, &x, nullptr, nullptr); // Return the requested information - return s_Vector3.x; + return x; } // ------------------------------------------------------------------------------------------------ @@ -1465,12 +1474,12 @@ Float32 CVehicle::GetEulerRotationY() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.y = 0; + // Reserve a temporary float to retrieve the requested component + Float32 y = 0.0f; // Query the server for the requested component value - _Func->GetVehicleRotationEuler(m_ID, nullptr, &s_Vector3.y, nullptr); + _Func->GetVehicleRotationEuler(m_ID, nullptr, &y, nullptr); // Return the requested information - return s_Vector3.y; + return y; } // ------------------------------------------------------------------------------------------------ @@ -1478,12 +1487,12 @@ Float32 CVehicle::GetEulerRotationZ() const { // Validate the managed identifier Validate(); - // Clear previous information, if any - s_Vector3.z = 0; + // Reserve a temporary float to retrieve the requested component + Float32 z = 0.0f; // Query the server for the requested component value - _Func->GetVehicleRotationEuler(m_ID, nullptr, nullptr, &s_Vector3.z); + _Func->GetVehicleRotationEuler(m_ID, nullptr, nullptr, &z); // Return the requested information - return s_Vector3.z; + return z; } // ------------------------------------------------------------------------------------------------ @@ -1491,10 +1500,12 @@ void CVehicle::SetEulerRotationX(Float32 x) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 y, z; // Retrieve the current values for unchanged components - _Func->GetVehicleRotationEuler(m_ID, nullptr, &s_Vector3.y, &s_Vector3.z); + _Func->GetVehicleRotationEuler(m_ID, nullptr, &y, &z); // Perform the requested operation - _Func->SetVehicleRotationEuler(m_ID, x, s_Vector3.y, s_Vector3.z); + _Func->SetVehicleRotationEuler(m_ID, x, y, z); } // ------------------------------------------------------------------------------------------------ @@ -1502,10 +1513,12 @@ void CVehicle::SetEulerRotationY(Float32 y) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, z; // Retrieve the current values for unchanged components - _Func->GetVehicleRotationEuler(m_ID, &s_Vector3.x, nullptr, &s_Vector3.z); + _Func->GetVehicleRotationEuler(m_ID, &x, nullptr, &z); // Perform the requested operation - _Func->SetVehicleRotationEuler(m_ID, s_Vector3.x, y, s_Vector3.z); + _Func->SetVehicleRotationEuler(m_ID, x, y, z); } // ------------------------------------------------------------------------------------------------ @@ -1513,10 +1526,12 @@ void CVehicle::SetEulerRotationZ(Float32 z) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, y; // Retrieve the current values for unchanged components - _Func->GetVehicleRotationEuler(m_ID, &s_Vector3.x, &s_Vector3.y, nullptr); + _Func->GetVehicleRotationEuler(m_ID, &x, &y, nullptr); // Perform the requested operation - _Func->SetVehicleRotationEuler(m_ID, s_Vector3.z, s_Vector3.y, z); + _Func->SetVehicleRotationEuler(m_ID, z, y, z); } // ------------------------------------------------------------------------------------------------ @@ -1525,11 +1540,11 @@ Float32 CVehicle::GetSpeedX() const // Validate the managed identifier Validate(); // Clear previous information, if any - s_Vector3.x = 0.0f; + Float32 x = 0.0f; // Query the server for the requested component value - _Func->GetVehicleSpeed(m_ID, &s_Vector3.x, nullptr, nullptr, false); + _Func->GetVehicleSpeed(m_ID, &x, nullptr, nullptr, false); // Return the requested information - return s_Vector3.x; + return x; } // ------------------------------------------------------------------------------------------------ @@ -1538,11 +1553,11 @@ Float32 CVehicle::GetSpeedY() const // Validate the managed identifier Validate(); // Clear previous information, if any - s_Vector3.y = 0.0f; + Float32 y = 0.0f; // Query the server for the requested component value - _Func->GetVehicleSpeed(m_ID, nullptr, &s_Vector3.y, nullptr, false); + _Func->GetVehicleSpeed(m_ID, nullptr, &y, nullptr, false); // Return the requested information - return s_Vector3.y; + return y; } // ------------------------------------------------------------------------------------------------ @@ -1551,11 +1566,11 @@ Float32 CVehicle::GetSpeedZ() const // Validate the managed identifier Validate(); // Clear previous information, if any - s_Vector3.z = 0.0f; + Float32 z = 0.0f; // Query the server for the requested component value - _Func->GetVehicleSpeed(m_ID, nullptr, nullptr, &s_Vector3.z, false); + _Func->GetVehicleSpeed(m_ID, nullptr, nullptr, &z, false); // Return the requested information - return s_Vector3.z; + return z; } // ------------------------------------------------------------------------------------------------ @@ -1563,10 +1578,12 @@ void CVehicle::SetSpeedX(Float32 x) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 y, z; // Retrieve the current values for unchanged components - _Func->GetVehicleSpeed(m_ID, nullptr, &s_Vector3.y, &s_Vector3.z, false); + _Func->GetVehicleSpeed(m_ID, nullptr, &y, &z, false); // Perform the requested operation - _Func->SetVehicleSpeed(m_ID, x, s_Vector3.y, s_Vector3.z, false, false); + _Func->SetVehicleSpeed(m_ID, x, y, z, false, false); } // ------------------------------------------------------------------------------------------------ @@ -1574,10 +1591,12 @@ void CVehicle::SetSpeedY(Float32 y) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, z; // Retrieve the current values for unchanged components - _Func->GetVehicleSpeed(m_ID, &s_Vector3.x, nullptr, &s_Vector3.z, false); + _Func->GetVehicleSpeed(m_ID, &x, nullptr, &z, false); // Perform the requested operation - _Func->SetVehicleSpeed(m_ID, s_Vector3.x, y, s_Vector3.z, false, false); + _Func->SetVehicleSpeed(m_ID, x, y, z, false, false); } // ------------------------------------------------------------------------------------------------ @@ -1585,10 +1604,12 @@ void CVehicle::SetSpeedZ(Float32 z) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, y; // Retrieve the current values for unchanged components - _Func->GetVehicleSpeed(m_ID, &s_Vector3.x, &s_Vector3.y, nullptr, false); + _Func->GetVehicleSpeed(m_ID, &x, &y, nullptr, false); // Perform the requested operation - _Func->SetVehicleSpeed(m_ID, s_Vector3.z, s_Vector3.y, z, false, false); + _Func->SetVehicleSpeed(m_ID, z, y, z, false, false); } // ------------------------------------------------------------------------------------------------ @@ -1597,11 +1618,11 @@ Float32 CVehicle::GetRelativeSpeedX() const // Validate the managed identifier Validate(); // Clear previous information, if any - s_Vector3.x = 0.0f; + Float32 x = 0.0f; // Query the server for the requested component value - _Func->GetVehicleSpeed(m_ID, &s_Vector3.x, nullptr, nullptr, true); + _Func->GetVehicleSpeed(m_ID, &x, nullptr, nullptr, true); // Return the requested information - return s_Vector3.x; + return x; } // ------------------------------------------------------------------------------------------------ @@ -1610,11 +1631,11 @@ Float32 CVehicle::GetRelativeSpeedY() const // Validate the managed identifier Validate(); // Clear previous information, if any - s_Vector3.y = 0.0f; + Float32 y = 0.0f; // Query the server for the requested component value - _Func->GetVehicleSpeed(m_ID, nullptr, &s_Vector3.y, nullptr, true); + _Func->GetVehicleSpeed(m_ID, nullptr, &y, nullptr, true); // Return the requested information - return s_Vector3.y; + return y; } // ------------------------------------------------------------------------------------------------ @@ -1623,11 +1644,11 @@ Float32 CVehicle::GetRelativeSpeedZ() const // Validate the managed identifier Validate(); // Clear previous information, if any - s_Vector3.z = 0.0f; + Float32 z = 0.0f; // Query the server for the requested component value - _Func->GetVehicleSpeed(m_ID, nullptr, nullptr, &s_Vector3.z, true); + _Func->GetVehicleSpeed(m_ID, nullptr, nullptr, &z, true); // Return the requested information - return s_Vector3.z; + return z; } // ------------------------------------------------------------------------------------------------ @@ -1635,10 +1656,12 @@ void CVehicle::SetRelativeSpeedX(Float32 x) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 y, z; // Retrieve the current values for unchanged components - _Func->GetVehicleSpeed(m_ID, nullptr, &s_Vector3.y, &s_Vector3.z, true); + _Func->GetVehicleSpeed(m_ID, nullptr, &y, &z, true); // Perform the requested operation - _Func->SetVehicleSpeed(m_ID, x, s_Vector3.y, s_Vector3.z, false, true); + _Func->SetVehicleSpeed(m_ID, x, y, z, false, true); } // ------------------------------------------------------------------------------------------------ @@ -1646,10 +1669,12 @@ void CVehicle::SetRelativeSpeedY(Float32 y) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, z; // Retrieve the current values for unchanged components - _Func->GetVehicleSpeed(m_ID, &s_Vector3.x, nullptr, &s_Vector3.z, true); + _Func->GetVehicleSpeed(m_ID, &x, nullptr, &z, true); // Perform the requested operation - _Func->SetVehicleSpeed(m_ID, s_Vector3.x, y, s_Vector3.z, false, true); + _Func->SetVehicleSpeed(m_ID, x, y, z, false, true); } // ------------------------------------------------------------------------------------------------ @@ -1657,10 +1682,12 @@ void CVehicle::SetRelativeSpeedZ(Float32 z) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, y; // Retrieve the current values for unchanged components - _Func->GetVehicleSpeed(m_ID, &s_Vector3.x, &s_Vector3.y, nullptr, true); + _Func->GetVehicleSpeed(m_ID, &x, &y, nullptr, true); // Perform the requested operation - _Func->SetVehicleSpeed(m_ID, s_Vector3.z, s_Vector3.y, z, false, true); + _Func->SetVehicleSpeed(m_ID, z, y, z, false, true); } // ------------------------------------------------------------------------------------------------ @@ -1669,11 +1696,11 @@ Float32 CVehicle::GetTurnSpeedX() const // Validate the managed identifier Validate(); // Clear previous information, if any - s_Vector3.x = 0.0f; + Float32 x = 0.0f; // Query the server for the requested component value - _Func->GetVehicleTurnSpeed(m_ID, &s_Vector3.x, nullptr, nullptr, false); + _Func->GetVehicleTurnSpeed(m_ID, &x, nullptr, nullptr, false); // Return the requested information - return s_Vector3.x; + return x; } // ------------------------------------------------------------------------------------------------ @@ -1682,11 +1709,11 @@ Float32 CVehicle::GetTurnSpeedY() const // Validate the managed identifier Validate(); // Clear previous information, if any - s_Vector3.y = 0.0f; + Float32 y = 0.0f; // Query the server for the requested component value - _Func->GetVehicleTurnSpeed(m_ID, nullptr, &s_Vector3.y, nullptr, false); + _Func->GetVehicleTurnSpeed(m_ID, nullptr, &y, nullptr, false); // Return the requested information - return s_Vector3.y; + return y; } // ------------------------------------------------------------------------------------------------ @@ -1695,11 +1722,11 @@ Float32 CVehicle::GetTurnSpeedZ() const // Validate the managed identifier Validate(); // Clear previous information, if any - s_Vector3.z = 0.0f; + Float32 z = 0.0f; // Query the server for the requested component value - _Func->GetVehicleTurnSpeed(m_ID, nullptr, nullptr, &s_Vector3.z, false); + _Func->GetVehicleTurnSpeed(m_ID, nullptr, nullptr, &z, false); // Return the requested information - return s_Vector3.z; + return z; } // ------------------------------------------------------------------------------------------------ @@ -1707,10 +1734,12 @@ void CVehicle::SetTurnSpeedX(Float32 x) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 y, z; // Retrieve the current values for unchanged components - _Func->GetVehicleTurnSpeed(m_ID, nullptr, &s_Vector3.y, &s_Vector3.z, false); + _Func->GetVehicleTurnSpeed(m_ID, nullptr, &y, &z, false); // Perform the requested operation - _Func->SetVehicleTurnSpeed(m_ID, x, s_Vector3.y, s_Vector3.z, false, false); + _Func->SetVehicleTurnSpeed(m_ID, x, y, z, false, false); } // ------------------------------------------------------------------------------------------------ @@ -1718,10 +1747,12 @@ void CVehicle::SetTurnSpeedY(Float32 y) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, z; // Retrieve the current values for unchanged components - _Func->GetVehicleTurnSpeed(m_ID, &s_Vector3.x, nullptr, &s_Vector3.z, false); + _Func->GetVehicleTurnSpeed(m_ID, &x, nullptr, &z, false); // Perform the requested operation - _Func->SetVehicleTurnSpeed(m_ID, s_Vector3.x, y, s_Vector3.z, false, false); + _Func->SetVehicleTurnSpeed(m_ID, x, y, z, false, false); } // ------------------------------------------------------------------------------------------------ @@ -1729,10 +1760,12 @@ void CVehicle::SetTurnSpeedZ(Float32 z) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, y; // Retrieve the current values for unchanged components - _Func->GetVehicleTurnSpeed(m_ID, &s_Vector3.x, &s_Vector3.y, nullptr, false); + _Func->GetVehicleTurnSpeed(m_ID, &x, &y, nullptr, false); // Perform the requested operation - _Func->SetVehicleTurnSpeed(m_ID, s_Vector3.z, s_Vector3.y, z, false, false); + _Func->SetVehicleTurnSpeed(m_ID, z, y, z, false, false); } // ------------------------------------------------------------------------------------------------ @@ -1741,11 +1774,11 @@ Float32 CVehicle::GetRelativeTurnSpeedX() const // Validate the managed identifier Validate(); // Clear previous information, if any - s_Vector3.x = 0.0f; + Float32 x = 0.0f; // Query the server for the requested component value - _Func->GetVehicleTurnSpeed(m_ID, &s_Vector3.x, nullptr, nullptr, true); + _Func->GetVehicleTurnSpeed(m_ID, &x, nullptr, nullptr, true); // Return the requested information - return s_Vector3.x; + return x; } // ------------------------------------------------------------------------------------------------ @@ -1754,11 +1787,11 @@ Float32 CVehicle::GetRelativeTurnSpeedY() const // Validate the managed identifier Validate(); // Clear previous information, if any - s_Vector3.y = 0.0f; + Float32 y = 0.0f; // Query the server for the requested component value - _Func->GetVehicleTurnSpeed(m_ID, nullptr, &s_Vector3.y, nullptr, true); + _Func->GetVehicleTurnSpeed(m_ID, nullptr, &y, nullptr, true); // Return the requested information - return s_Vector3.y; + return y; } // ------------------------------------------------------------------------------------------------ @@ -1767,11 +1800,11 @@ Float32 CVehicle::GetRelativeTurnSpeedZ() const // Validate the managed identifier Validate(); // Clear previous information, if any - s_Vector3.z = 0.0f; + Float32 z = 0.0f; // Query the server for the requested component value - _Func->GetVehicleTurnSpeed(m_ID, nullptr, nullptr, &s_Vector3.z, true); + _Func->GetVehicleTurnSpeed(m_ID, nullptr, nullptr, &z, true); // Return the requested information - return s_Vector3.z; + return z; } // ------------------------------------------------------------------------------------------------ @@ -1779,10 +1812,12 @@ void CVehicle::SetRelativeTurnSpeedX(Float32 x) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 y, z; // Retrieve the current values for unchanged components - _Func->GetVehicleTurnSpeed(m_ID, nullptr, &s_Vector3.y, &s_Vector3.z, true); + _Func->GetVehicleTurnSpeed(m_ID, nullptr, &y, &z, true); // Perform the requested operation - _Func->SetVehicleTurnSpeed(m_ID, x, s_Vector3.y, s_Vector3.z, false, true); + _Func->SetVehicleTurnSpeed(m_ID, x, y, z, false, true); } // ------------------------------------------------------------------------------------------------ @@ -1790,10 +1825,12 @@ void CVehicle::SetRelativeTurnSpeedY(Float32 y) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, z; // Retrieve the current values for unchanged components - _Func->GetVehicleTurnSpeed(m_ID, &s_Vector3.x, nullptr, &s_Vector3.z, true); + _Func->GetVehicleTurnSpeed(m_ID, &x, nullptr, &z, true); // Perform the requested operation - _Func->SetVehicleTurnSpeed(m_ID, s_Vector3.x, y, s_Vector3.z, false, true); + _Func->SetVehicleTurnSpeed(m_ID, x, y, z, false, true); } // ------------------------------------------------------------------------------------------------ @@ -1801,10 +1838,12 @@ void CVehicle::SetRelativeTurnSpeedZ(Float32 z) const { // Validate the managed identifier Validate(); + // Reserve some temporary floats to retrieve the missing components + Float32 x, y; // Retrieve the current values for unchanged components - _Func->GetVehicleTurnSpeed(m_ID, &s_Vector3.x, &s_Vector3.y, nullptr, true); + _Func->GetVehicleTurnSpeed(m_ID, &x, &y, nullptr, true); // Perform the requested operation - _Func->SetVehicleTurnSpeed(m_ID, s_Vector3.z, s_Vector3.y, z, false, true); + _Func->SetVehicleTurnSpeed(m_ID, z, y, z, false, true); } // ------------------------------------------------------------------------------------------------ diff --git a/source/Entity/Vehicle.hpp b/source/Entity/Vehicle.hpp index 1d39ee65..1e34a47c 100644 --- a/source/Entity/Vehicle.hpp +++ b/source/Entity/Vehicle.hpp @@ -32,11 +32,6 @@ class CVehicle private: - // -------------------------------------------------------------------------------------------- - static Vector2 s_Vector2; - static Vector3 s_Vector3; - static Quaternion s_Quaternion; - /* -------------------------------------------------------------------------------------------- * Identifier of the managed entity. */ @@ -275,7 +270,7 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the position of the managed vehicle entity. */ - const Vector3 & GetPosition() const; + Vector3 GetPosition() const; /* -------------------------------------------------------------------------------------------- * Modify the position of the managed vehicle entity. @@ -300,7 +295,7 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the rotation of the managed vehicle entity. */ - const Quaternion & GetRotation() const; + Quaternion GetRotation() const; /* -------------------------------------------------------------------------------------------- * Modify the rotation of the managed vehicle entity. @@ -315,7 +310,7 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the euler rotation of the managed vehicle entity. */ - const Vector3 & GetRotationEuler() const; + Vector3 GetRotationEuler() const; /* -------------------------------------------------------------------------------------------- * Modify the euler rotation of the managed vehicle entity. @@ -330,7 +325,7 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the speed of the managed vehicle entity. */ - const Vector3 & GetSpeed() const; + Vector3 GetSpeed() const; /* -------------------------------------------------------------------------------------------- * Modify the speed of the managed vehicle entity. @@ -355,7 +350,7 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the relative speed of the managed vehicle entity. */ - const Vector3 & GetRelativeSpeed() const; + Vector3 GetRelativeSpeed() const; /* -------------------------------------------------------------------------------------------- * Modify the relative speed of the managed vehicle entity. @@ -380,7 +375,7 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the turn speed of the managed vehicle entity. */ - const Vector3 & GetTurnSpeed() const; + Vector3 GetTurnSpeed() const; /* -------------------------------------------------------------------------------------------- * Modify the turn speed of the managed vehicle entity. @@ -405,7 +400,7 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the relative turn speed of the managed vehicle entity. */ - const Vector3 & GetRelativeTurnSpeed() const; + Vector3 GetRelativeTurnSpeed() const; /* -------------------------------------------------------------------------------------------- * Modify the relative turn speed of the managed vehicle entity. @@ -430,7 +425,7 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the spawn position of the managed vehicle entity. */ - const Vector3 & GetSpawnPosition() const; + Vector3 GetSpawnPosition() const; /* -------------------------------------------------------------------------------------------- * Modify the spawn position of the managed vehicle entity. @@ -445,7 +440,7 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the spawn rotation of the managed vehicle entity. */ - const Quaternion & GetSpawnRotation() const; + Quaternion GetSpawnRotation() const; /* -------------------------------------------------------------------------------------------- * Modify the spawn rotation of the managed vehicle entity. @@ -460,7 +455,7 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the euler spawn rotation of the managed vehicle entity. */ - const Vector3 & GetSpawnRotationEuler() const; + Vector3 GetSpawnRotationEuler() const; /* -------------------------------------------------------------------------------------------- * Modify the euler spawn rotation of the managed vehicle entity. @@ -565,7 +560,7 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the turret rotation of the managed vehicle entity. */ - const Vector2 & GetTurretRotation() const; + Vector2 GetTurretRotation() const; /* -------------------------------------------------------------------------------------------- * Retrieve the horizontal turret rotation of the managed vehicle entity.