Clean up some code

Former-commit-id: 0bc6e1d237dfe261aa413d75f66da8a7cef01e79 [formerly bd0666073e7d9b9ec6228738741f7ce563c5f309] [formerly 0757422d16c83bfd7ff4b099beed99c68afd1fbb [formerly db0fa1476c93cbfe2ce5e76ffcb726812c338dcf]]
Former-commit-id: bd671d7c3e5a0da5c9088baed015f6c8462892dd [formerly 324d8fe2327a2b508ba3dcd29ec9c7b8adc9c56c]
Former-commit-id: ee42b1f6a136b99e954b38fe386d0faf24621efa
This commit is contained in:
Lynix 2016-09-04 20:40:02 +02:00
parent d28142166e
commit 2674937384
3 changed files with 9 additions and 16 deletions

View File

@ -134,7 +134,7 @@ namespace Nz
class NAZARA_PHYSICS_API CompoundGeom : public PhysGeom
{
public:
CompoundGeom(PhysGeom** geoms, unsigned int geomCount);
CompoundGeom(PhysGeom** geoms, std::size_t geomCount);
const std::vector<PhysGeomRef>& GetGeoms() const;
GeomType GetType() const override;

View File

@ -56,7 +56,7 @@ namespace Nz
std::array<char, NI_MAXHOST> hostnameBuffer;
std::array<char, NI_MAXSERV> serviceBuffer;
int result = getnameinfo(socketAddress, socketLen, hostnameBuffer.data(), static_cast<std::size_t>(hostnameBuffer.size()), serviceBuffer.data(), static_cast<std::size_t>(serviceBuffer.size()), flags);
int result = getnameinfo(socketAddress, socketLen, hostnameBuffer.data(), static_cast<DWORD>(hostnameBuffer.size()), serviceBuffer.data(), static_cast<DWORD>(serviceBuffer.size()), flags);
if (result == 0)
{
if (hostname)

View File

@ -125,16 +125,7 @@ namespace Nz
PhysGeomRef PhysGeom::Build(const PrimitiveList& list)
{
unsigned int primitiveCount = list.GetSize();
#if NAZARA_PHYSICS_SAFE
if (primitiveCount == 0)
{
NazaraError("PrimitiveList must have at least one primitive");
return nullptr;
}
#endif
std::size_t primitiveCount = list.GetSize();
if (primitiveCount > 1)
{
std::vector<PhysGeom*> geoms(primitiveCount);
@ -144,8 +135,10 @@ namespace Nz
return CompoundGeom::New(&geoms[0], primitiveCount);
}
else
else if (primitiveCount > 0)
return CreateGeomFromPrimitive(list.GetPrimitive(0));
else
return NullGeom::New();
}
bool PhysGeom::Initialize()
@ -246,10 +239,10 @@ namespace Nz
/******************************* CompoundGeom ********************************/
CompoundGeom::CompoundGeom(PhysGeom** geoms, unsigned int geomCount)
CompoundGeom::CompoundGeom(PhysGeom** geoms, std::size_t geomCount)
{
m_geoms.reserve(geomCount);
for (unsigned int i = 0; i < geomCount; ++i)
for (std::size_t i = 0; i < geomCount; ++i)
m_geoms.emplace_back(geoms[i]);
}
@ -349,7 +342,7 @@ namespace Nz
NewtonCollision* ConvexHullGeom::CreateHandle(PhysWorld* world) const
{
return NewtonCreateConvexHull(world->GetHandle(), m_vertices.size(), reinterpret_cast<const float*>(m_vertices.data()), sizeof(Vector3f), m_tolerance, 0, m_matrix);
return NewtonCreateConvexHull(world->GetHandle(), static_cast<int>(m_vertices.size()), reinterpret_cast<const float*>(m_vertices.data()), sizeof(Vector3f), m_tolerance, 0, m_matrix);
}
/******************************* CylinderGeom ********************************/