diff --git a/Client/game_sa/CEntitySA.cpp b/Client/game_sa/CEntitySA.cpp index 02a9f00380..9053910737 100644 --- a/Client/game_sa/CEntitySA.cpp +++ b/Client/game_sa/CEntitySA.cpp @@ -679,7 +679,7 @@ bool CEntitySA::GetBonePosition(eBone boneId, CVector& position) return false; const RwV3d& pos = rwBoneMatrix->pos; - position = {pos.x, pos.y, pos.z}; + position = CVector(pos.x, pos.y, pos.z); return true; } diff --git a/Shared/mods/deathmatch/logic/lua/CLuaFunctionParser.h b/Shared/mods/deathmatch/logic/lua/CLuaFunctionParser.h index fef13d708b..8f3615f3bd 100644 --- a/Shared/mods/deathmatch/logic/lua/CLuaFunctionParser.h +++ b/Shared/mods/deathmatch/logic/lua/CLuaFunctionParser.h @@ -561,7 +561,7 @@ struct CLuaFunctionParserBase else if constexpr (std::is_same_v) { if (lua_isnumber(L, index)) - return {PopUnsafe(L, index), PopUnsafe(L, index), PopUnsafe(L, index)}; + return CVector(PopUnsafe(L, index), PopUnsafe(L, index), PopUnsafe(L, index)); int iType = lua_type(L, index); bool isLightUserData = iType == LUA_TLIGHTUSERDATA; diff --git a/Shared/sdk/CVector.h b/Shared/sdk/CVector.h index 5c2ddde7a6..b39bfb951e 100644 --- a/Shared/sdk/CVector.h +++ b/Shared/sdk/CVector.h @@ -30,13 +30,12 @@ class CVector float fY; float fZ; - struct NoInit{}; + struct NoInit {}; + CVector(NoInit) noexcept {} - CVector(NoInit) {} - - constexpr CVector() : fX(0.0f), fY(0.0f), fZ(0.0f) {} - - constexpr CVector(float x, float y, float z) : fX(x), fY(y), fZ(z) {} + constexpr CVector() noexcept : fX(0.0f), fY(0.0f), fZ(0.0f) {} + + constexpr explicit CVector(float x, float y = 0.0f, float z = 0.0f) noexcept : fX(x), fY(y), fZ(z) {} constexpr CVector(const CVector4D& vec) noexcept : fX(vec.fX), fY(vec.fY), fZ(vec.fZ) {} @@ -187,7 +186,7 @@ class CVector { *outVec = *this + vecRay * t; if (outHitBary) { // Calculate all barycentric coords if necessary - *outHitBary = { 1.f - u - v, u, v }; // For vertices A, B, C [I assume?] + *outHitBary = CVector( 1.f - u - v, u, v ); // For vertices A, B, C [I assume?] } return true; }