diff --git a/src/containers/Map.h b/src/containers/Map.h index 5a2b75be..3e077fa5 100755 --- a/src/containers/Map.h +++ b/src/containers/Map.h @@ -427,7 +427,7 @@ class Map { } /// Allocate memory for a given number of elements - void reserve(size_t capacity) { + void reserve(int capacity) { if (capacity <= mCapacity) return; diff --git a/src/memory/MemoryManager.h b/src/memory/MemoryManager.h index 8d986a31..2787c067 100644 --- a/src/memory/MemoryManager.h +++ b/src/memory/MemoryManager.h @@ -97,10 +97,12 @@ class MemoryManager { inline void* MemoryManager::allocate(AllocationType allocationType, size_t size) { switch (allocationType) { - case AllocationType::Base: return mBaseAllocator->allocate(size); break; - case AllocationType::Pool: return mPoolAllocator.allocate(size); break; - case AllocationType::Frame: return mSingleFrameAllocator.allocate(size); break; + case AllocationType::Base: return mBaseAllocator->allocate(size); + case AllocationType::Pool: return mPoolAllocator.allocate(size); + case AllocationType::Frame: return mSingleFrameAllocator.allocate(size); } + + return nullptr; } // Release previously allocated memory. diff --git a/test/tests/collision/TestCollisionWorld.h b/test/tests/collision/TestCollisionWorld.h index 3538c418..1863cdee 100644 --- a/test/tests/collision/TestCollisionWorld.h +++ b/test/tests/collision/TestCollisionWorld.h @@ -2518,10 +2518,7 @@ class TestCollisionWorld : public Test { test(collisionData->getNbContactManifolds() == 1); test(collisionData->getTotalNbContactPoints() == 4); - // True if the bodies are swapped in the collision callback response - bool swappedBodiesCollisionData = collisionData->getBody1()->getId() != mBoxBody1->getId(); - - for (int i=0; icontactManifolds[0].contactPoints.size(); i++) { + for (size_t i=0; icontactManifolds[0].contactPoints.size(); i++) { test(approxEqual(collisionData->contactManifolds[0].contactPoints[i].penetrationDepth, 1.0f)); } @@ -2538,10 +2535,7 @@ class TestCollisionWorld : public Test { test(collisionData->getNbContactManifolds() == 1); test(collisionData->getTotalNbContactPoints() == 4); - // True if the bodies are swapped in the collision callback response - swappedBodiesCollisionData = collisionData->getBody1()->getId() != mBoxBody1->getId(); - - for (int i=0; icontactManifolds[0].contactPoints.size(); i++) { + for (size_t i=0; icontactManifolds[0].contactPoints.size(); i++) { test(approxEqual(collisionData->contactManifolds[0].contactPoints[i].penetrationDepth, 1.0f)); } @@ -2558,10 +2552,7 @@ class TestCollisionWorld : public Test { test(collisionData->getNbContactManifolds() == 1); test(collisionData->getTotalNbContactPoints() == 4); - // True if the bodies are swapped in the collision callback response - swappedBodiesCollisionData = collisionData->getBody1()->getId() != mBoxBody1->getId(); - - for (int i=0; icontactManifolds[0].contactPoints.size(); i++) { + for (size_t i=0; icontactManifolds[0].contactPoints.size(); i++) { test(approxEqual(collisionData->contactManifolds[0].contactPoints[i].penetrationDepth, 1.0f)); } @@ -2578,11 +2569,8 @@ class TestCollisionWorld : public Test { test(collisionData->getNbContactManifolds() == 1); test(collisionData->getTotalNbContactPoints() == 4); - // True if the bodies are swapped in the collision callback response - swappedBodiesCollisionData = collisionData->getBody1()->getId() != mBoxBody1->getId(); - // Test contact points - for (int i=0; icontactManifolds[0].contactPoints.size(); i++) { + for (size_t i=0; icontactManifolds[0].contactPoints.size(); i++) { test(approxEqual(collisionData->contactManifolds[0].contactPoints[i].penetrationDepth, 1.0f)); } @@ -2652,10 +2640,7 @@ class TestCollisionWorld : public Test { test(collisionData->getNbContactManifolds() == 1); test(collisionData->getTotalNbContactPoints() == 4); - // True if the bodies are swapped in the collision callback response - swappedBodiesCollisionData = collisionData->getBody1()->getId() != mConvexMeshBody1->getId(); - - for (int i=0; icontactManifolds[0].contactPoints.size(); i++) { + for (size_t i=0; icontactManifolds[0].contactPoints.size(); i++) { test(approxEqual(collisionData->contactManifolds[0].contactPoints[i].penetrationDepth, 1.0f)); } @@ -2672,10 +2657,7 @@ class TestCollisionWorld : public Test { test(collisionData->getNbContactManifolds() == 1); test(collisionData->getTotalNbContactPoints() == 4); - // True if the bodies are swapped in the collision callback response - swappedBodiesCollisionData = collisionData->getBody1()->getId() != mConvexMeshBody1->getId(); - - for (int i=0; icontactManifolds[0].contactPoints.size(); i++) { + for (size_t i=0; icontactManifolds[0].contactPoints.size(); i++) { test(approxEqual(collisionData->contactManifolds[0].contactPoints[i].penetrationDepth, 1.0f)); } @@ -2692,11 +2674,8 @@ class TestCollisionWorld : public Test { test(collisionData->getNbContactManifolds() == 1); test(collisionData->getTotalNbContactPoints() == 4); - // True if the bodies are swapped in the collision callback response - swappedBodiesCollisionData = collisionData->getBody1()->getId() != mConvexMeshBody1->getId(); - // Test contact points - for (int i=0; icontactManifolds[0].contactPoints.size(); i++) { + for (size_t i=0; icontactManifolds[0].contactPoints.size(); i++) { test(approxEqual(collisionData->contactManifolds[0].contactPoints[i].penetrationDepth, 1.0f)); }