i had to apply the following patch to get the latest code to compile on a 64 bit linux machine:
Code:
--- src/dynamicsworld.cpp (revision 3127)
+++ src/dynamicsworld.cpp (working copy)
@@ -233,7 +233,7 @@
for (int k = 0; k < manifold->getNumContacts(); ++k)
{
btManifoldPoint& pt = manifold->getContactPoint(k);
- int id = (int)shape->getChildShape(pt.m_index0)->getUserPointer();
+ size_t id = (size_t)shape->getChildShape(pt.m_index0)->getUserPointer();
if (id >= 0)
{
btScalar& accImpulse = body->m_connections[id].m_accImpulse;
@@ -254,7 +254,7 @@
for (int k = 0; k < manifold->getNumContacts(); ++k)
{
btManifoldPoint& pt = manifold->getContactPoint(k);
- int id = (int)shape->getChildShape(pt.m_index1)->getUserPointer();
+ size_t id = (size_t)shape->getChildShape(pt.m_index1)->getUserPointer();
if (id >= 0)
{
btScalar& accImpulse = body->m_connections[id].m_accImpulse;
Index: src/fracturebody.cpp
===================================================================
--- src/fracturebody.cpp (revision 3127)
+++ src/fracturebody.cpp (working copy)
@@ -55,7 +55,7 @@
compound->removeChildShapeByIndex(shapeId);
// remove will swap last shape with shapeId need to update connection
- id = (int)compound->getChildShape(shapeId)->getUserPointer();
+ id = (size_t)compound->getChildShape(shapeId)->getUserPointer();
if (id >= 0 && shapeId <= compound->getNumChildShapes())
{
m_connections[id].m_shapeId = shapeId;
@@ -81,7 +81,7 @@
const btCompoundShape* shape = (btCompoundShape*)getCollisionShape();
for (int i = 0; i < shape->getNumChildShapes(); ++i)
{
- int id = (int)shape->getChildShape(i)->getUserPointer();
+ size_t id = (size_t)shape->getChildShape(i)->getUserPointer();
if (id >= 0)
{
btTransform transform;
@@ -105,7 +105,7 @@
const btCompoundShape* shape = (btCompoundShape*)getCollisionShape();
for (int i = 0; i < shape->getNumChildShapes(); ++i)
{
- std::cerr << "shape " << (int)shape->getChildShape(i)->getUserPointer() << " " << shape->getChildShape(i) << std::endl;
+ std::cerr << "shape " << (size_t)shape->getChildShape(i)->getUserPointer() << " " << shape->getChildShape(i) << std::endl;
}
}
i took a quick look at the code and i saw thing like setUserPointer(-1) and then checking for getUserPointer() to be greater or equal to zero. i just go by the name of the functions, so i assume we're dealing with pointers. since when can pointers be negative? i always thought 0 means no pointer defined, >0 points to an object.
shouldn't the code be changed to setUserPointer(0) in the constructor and then checking for a valid pointer (i.e. >0) later on?
second, when dealing with pointers always use size_t to make it work on a 64-bit system (where an int and a pointer have different sizes).
--alex--