Browse Source

Sonar fix (#436)

Jorrit Rouwe 2 years ago
parent
commit
37a4137ef9

+ 3 - 1
Jolt/Core/StaticArray.h

@@ -14,6 +14,8 @@ public:
 
 	using size_type = uint;
 
+	static constexpr uint Capacity = N;
+
 	/// Default constructor
 						StaticArray() = default;
 
@@ -87,7 +89,7 @@ public:
 	}
 
 	/// Returns maximum amount of elements the array can hold
-	static constexpr size_type capacity()
+	size_type			capacity() const
 	{
 		return N;
 	}

+ 1 - 1
Jolt/Physics/Collision/EstimateCollisionResponse.cpp

@@ -78,7 +78,7 @@ void EstimateCollisionResponse(const Body &inBody1, const Body &inBody2, const C
 	};
 
 	// Initialize the constraint properties
-	ContactConstraint constraints[ContactPoints::capacity()];
+	ContactConstraint constraints[ContactPoints::Capacity];
 	JPH_ASSERT(inManifold.mRelativeContactPointsOn1.size() == inManifold.mRelativeContactPointsOn2.size());
 	for (uint c = 0; c < inManifold.mRelativeContactPointsOn1.size(); ++c)
 	{

+ 1 - 1
Jolt/Physics/Collision/EstimateCollisionResponse.h

@@ -7,7 +7,7 @@
 
 JPH_NAMESPACE_BEGIN
 
-using ContactImpulses = StaticArray<float, ContactPoints::capacity()>;
+using ContactImpulses = StaticArray<float, ContactPoints::Capacity>;
 
 /// This function estimates the contact impulses and body velocity changes as a result of a collision.
 /// It can be used in the ContactListener::OnContactAdded to determine the strength of the collision to e.g. play a sound or trigger a particle system.