Ken's 64bit patches weren't merged over to orange for some reason.
authorKent Mein <mein@cs.umn.edu>
Thu, 12 Jan 2006 15:27:20 +0000 (15:27 +0000)
committerKent Mein <mein@cs.umn.edu>
Thu, 12 Jan 2006 15:27:20 +0000 (15:27 +0000)
This fixes that.

I'm going to see if there are other things that weren't merged over
as well.

Kent

18 files changed:
source/gameengine/Expressions/KX_HashedPtr.cpp
source/gameengine/Expressions/KX_HashedPtr.h
source/gameengine/Ketsji/KX_CameraIpoSGController.cpp
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_IPO_SGController.cpp
source/gameengine/Ketsji/KX_LightIpoSGController.cpp
source/gameengine/Ketsji/KX_ObColorIpoSGController.cpp
source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
source/gameengine/Ketsji/KX_WorldIpoController.cpp
source/gameengine/Physics/BlOde/OdePhysicsEnvironment.h
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp
source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h
source/gameengine/Physics/Sumo/SumoPhysicsEnvironment.cpp
source/gameengine/Physics/Sumo/SumoPhysicsEnvironment.h
source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
source/kernel/gen_system/GEN_HashedPtr.h

index d01ff1626d79dc068488bceffe24b62dcc290207..b1eeff207668b1cde924fa0f006a616bb8c80c64 100644 (file)
 #include <config.h>
 #endif
 
-unsigned int KX_Hash(unsigned int inDWord)
+unsigned int KX_Hash(void * inDWord)
 {
-       unsigned int key = inDWord;
+#if defined(_WIN64)
+       unsigned __int64 key = (unsigned __int64)inDWord;
+#else
+       unsigned long key = (unsigned long)inDWord;
+#endif
+
        key += ~(key << 16);
        key ^=  (key >>  5);
        key +=  (key <<  3);
        key ^=  (key >> 13);
        key += ~(key <<  9);
        key ^=  (key >> 17);
-       return key;
-};
 
+       return (unsigned int)(key & 0xffffffff);
+}
 
 
 CHashedPtr::CHashedPtr(void* val) : m_valptr(val)
@@ -57,5 +62,5 @@ CHashedPtr::CHashedPtr(void* val) : m_valptr(val)
 
 unsigned int CHashedPtr::hash() const
 {
-       return KX_Hash((unsigned int) m_valptr);
+       return KX_Hash(m_valptr);
 }
index 18d183c2ae8d65993f97af8aa4fd317d79cab43b..06e86854d82a55c47961778fac4a910758962152 100644 (file)
@@ -32,7 +32,7 @@
 #ifndef __KX_HASHEDPTR
 #define __KX_HASHEDPTR
 
-unsigned int                   KX_Hash(unsigned int inDWord);
+unsigned int                   KX_Hash(void * inDWord);
 
 class CHashedPtr
 {
index 425493dbe7e8c235b5130ff13d0506f9d63f5538..38064739ff071d28980963734323d96c11f1ece4 100644 (file)
 #include <config.h>
 #endif
 
+#if defined(_WIN64)
+typedef unsigned __int64 uint_ptr;
+#else
+typedef unsigned long uint_ptr;
+#endif
+
 bool KX_CameraIpoSGController::Update(double currentTime)
 {
        if (m_modified)
@@ -92,10 +98,10 @@ SG_Controller*      KX_CameraIpoSGController::GetReplica(class SG_Node* destnode)
                iporeplica->AddInterpolator(copyipo);
 
                MT_Scalar* scaal = ((KX_ScalarInterpolator*)*i)->GetTarget();
-               int orgbase = (int)this;
-               int orgloc = (int)scaal;
-               int offset = orgloc-orgbase;
-               int newaddrbase = (int)iporeplica + offset;
+               uint_ptr orgbase = (uint_ptr)this;
+               uint_ptr orgloc = (uint_ptr)scaal;
+               uint_ptr offset = orgloc-orgbase;
+               uint_ptr newaddrbase = (uint_ptr)iporeplica + offset;
                MT_Scalar* blaptr = (MT_Scalar*) newaddrbase;
                copyipo->SetNewTarget((MT_Scalar*)blaptr);
        }
index a338e3c03d1dd11b7ab191bc6b8a19da78e3e5bf..42e5d550e57624976f913c4d4ab4347706bffc51 100644 (file)
 #include <config.h>
 #endif
 
+#if defined(_WIN64)
+typedef unsigned __int64 uint_ptr;
+#else
+typedef unsigned long uint_ptr;
+#endif
+
 #ifdef WIN32
 // This warning tells us about truncation of __long__ stl-generated names.
 // It can occasionally cause DevStudio to have internal compiler warnings.
@@ -1095,12 +1101,12 @@ PyObject* KX_GameObject::PyGetPhysicsId(PyObject* self,
                                                                                           PyObject* kwds)
 {
        KX_IPhysicsController* ctrl = GetPhysicsController();
-       int physid=0;
+       uint_ptr physid=0;
        if (ctrl)
        {
-               physid= (int)ctrl->GetUserData();
+               physid= (uint_ptr)ctrl->GetUserData();
        }
-       return PyInt_FromLong(physid);
+       return PyInt_FromLong((long)physid);
 }
 
 KX_PYMETHODDEF_DOC(KX_GameObject, getDistanceTo,
index e54fb11dc1436bb4e6a3a326b09b17a44df92893..920a65be0fbd6b7f8781dcd776a64c8362fded68 100644 (file)
 #include <config.h>
 #endif
 
+#if defined(_WIN64)
+typedef unsigned __int64 uint_ptr;
+#else
+typedef unsigned long uint_ptr;
+#endif
+
 #ifdef WIN32
 // This warning tells us about truncation of __long__ stl-generated names.
 // It can occasionally cause DevStudio to have internal compiler warnings.
@@ -168,10 +174,10 @@ SG_Controller*    KX_IpoSGController::GetReplica(class SG_Node* destnode)
                iporeplica->AddInterpolator(copyipo);
 
                MT_Scalar* scaal = ((KX_ScalarInterpolator*)*i)->GetTarget();
-               int orgbase = (int)&m_ipo_xform;
-               int orgloc = (int)scaal;
-               int offset = orgloc-orgbase;
-               int newaddrbase = (int)&iporeplica->m_ipo_xform;
+               uint_ptr orgbase = (uint_ptr)&m_ipo_xform;
+               uint_ptr orgloc = (uint_ptr)scaal;
+               uint_ptr offset = orgloc-orgbase;
+               uint_ptr newaddrbase = (uint_ptr)&iporeplica->m_ipo_xform;
                newaddrbase += offset;
                MT_Scalar* blaptr = (MT_Scalar*) newaddrbase;
                copyipo->SetNewTarget((MT_Scalar*)blaptr);
index e1bb3329ca84f967f5ee02b9868a778697e973fa..45865b7a6823a03133ead2b16463d1e1cba1c507 100644 (file)
 #include <config.h>
 #endif
 
+#if defined(_WIN64)
+typedef unsigned __int64 uint_ptr;
+#else
+typedef unsigned long uint_ptr;
+#endif
+
 bool KX_LightIpoSGController::Update(double currentTime)
 {
        if (m_modified)
@@ -97,10 +103,10 @@ SG_Controller*     KX_LightIpoSGController::GetReplica(class SG_Node* destnode)
                iporeplica->AddInterpolator(copyipo);
 
                MT_Scalar* scaal = ((KX_ScalarInterpolator*)*i)->GetTarget();
-               int orgbase = (int)this;
-               int orgloc = (int)scaal;
-               int offset = orgloc-orgbase;
-               int newaddrbase = (int)iporeplica + offset;
+               uint_ptr orgbase = (uint_ptr)this;
+               uint_ptr orgloc = (uint_ptr)scaal;
+               uint_ptr offset = orgloc-orgbase;
+               uint_ptr newaddrbase = (uint_ptr)iporeplica + offset;
                MT_Scalar* blaptr = (MT_Scalar*) newaddrbase;
                copyipo->SetNewTarget((MT_Scalar*)blaptr);
        }
index 58c1494724c2ba8f6323e3eb6672d92afb6a8356..b6d385da8ca49ed4c83b93c109a129c607b2dadd 100644 (file)
 #include <config.h>
 #endif
 
+#if defined(_WIN64)
+typedef unsigned __int64 uint_ptr;
+#else
+typedef unsigned long uint_ptr;
+#endif
+
+
 bool KX_ObColorIpoSGController::Update(double currentTime)
 {
        if (m_modified)
@@ -87,10 +94,10 @@ SG_Controller*      KX_ObColorIpoSGController::GetReplica(class SG_Node* destnode)
                iporeplica->AddInterpolator(copyipo);
 
                MT_Scalar* scaal = ((KX_ScalarInterpolator*)*i)->GetTarget();
-               int orgbase = (int)this;
-               int orgloc = (int)scaal;
-               int offset = orgloc-orgbase;
-               int newaddrbase = (int)iporeplica + offset;
+               uint_ptr orgbase = (uint_ptr)this;
+               uint_ptr orgloc = (uint_ptr)scaal;
+               uint_ptr offset = orgloc-orgbase;
+               uint_ptr newaddrbase = (uint_ptr)iporeplica + offset;
                MT_Scalar* blaptr = (MT_Scalar*) newaddrbase;
                copyipo->SetNewTarget((MT_Scalar*)blaptr);
        }
index f11a9a763fe84f3665ffc2696ce9d981e9b16626..2317f9c3a9cae89e4c34624cff2b3e22fb3e321b 100644 (file)
@@ -352,13 +352,17 @@ static PyObject* gPyRemoveConstraint(PyObject* self,
                                                                                 PyObject* args, 
                                                                                 PyObject* kwds)
 {
-       int constraintid;
-       
-       if (PyArg_ParseTuple(args,"i",&constraintid))
+#if defined(_WIN64)
+       __int64 constraintid;
+       if (PyArg_ParseTuple(args,"L",&constraintid))
+#else
+       long constraintid;
+       if (PyArg_ParseTuple(args,"l",&constraintid))
+#endif
        {
                if (PHY_GetActiveEnvironment())
                {
-                       PHY_GetActiveEnvironment()->removeConstraint(constraintid);
+                       PHY_GetActiveEnvironment()->removeConstraint((void *)constraintid);
                }
        }
        Py_INCREF(Py_None); return Py_None;
index c4800dc9d91591ee2f0241b612fb62088b5c473f..ded251f391e4dbf6bf418fe2b79e0579d7c3b804 100644 (file)
 #include <config.h>
 #endif
 
+#if defined(_WIN64)
+typedef unsigned __int64 uint_ptr;
+#else
+typedef unsigned long uint_ptr;
+#endif
+
 bool KX_WorldIpoController::Update(double currentTime)
 {
        if (m_modified)
@@ -92,10 +98,10 @@ SG_Controller*      KX_WorldIpoController::GetReplica(class SG_Node* destnode)
                iporeplica->AddInterpolator(copyipo);
 
                MT_Scalar* scaal = ((KX_ScalarInterpolator*)*i)->GetTarget();
-               int orgbase = (int)this;
-               int orgloc = (int)scaal;
-               int offset = orgloc-orgbase;
-               int newaddrbase = (int)iporeplica + offset;
+               uint_ptr orgbase = (uint_ptr)this;
+               uint_ptr orgloc = (uint_ptr)scaal;
+               uint_ptr offset = orgloc-orgbase;
+               uint_ptr newaddrbase = (uint_ptr)iporeplica + offset;
                MT_Scalar* blaptr = (MT_Scalar*) newaddrbase;
                copyipo->SetNewTarget((MT_Scalar*)blaptr);
        }
index 2214d642d7b858aaff229a3913aee8bd6c4106a6..bddc1e03be1be535d740d4e02477f89f3e85fa7f 100644 (file)
@@ -53,7 +53,7 @@ public:
                        float pivotX,float pivotY,float pivotZ,
                        float axisX,float axisY,float axisZ);
 
-       virtual void            removeConstraint(int constraintid);
+       virtual void            removeConstraint(void * constraintid);
        virtual PHY_IPhysicsController* rayTest(PHY_IPhysicsController* ignoreClient,float fromX,float fromY,float fromZ, float toX,float toY,float toZ, 
                                                                        float& hitX,float& hitY,float& hitZ,float& normalX,float& normalY,float& normalZ);
 
index 75a67e3cb376cec52e14a8113ba213838ba710d2..0a0b4939ea5d9ee24ea6bea29aad1757e9581bed 100644 (file)
@@ -192,7 +192,7 @@ void        CcdPhysicsEnvironment::removeCcdPhysicsController(CcdPhysicsController* ctr
                        if  ((&p2p->GetRigidBodyA() == ctrl->GetRigidBody() ||
                                (&p2p->GetRigidBodyB() == ctrl->GetRigidBody())))
                        {
-                               removeConstraint(int(p2p));
+                                removeConstraint(p2p);
                                //only 1 constraint per constroller
                                break;
                        }
@@ -209,7 +209,7 @@ void        CcdPhysicsEnvironment::removeCcdPhysicsController(CcdPhysicsController* ctr
                        if  ((&p2p->GetRigidBodyA() == ctrl->GetRigidBody() ||
                                (&p2p->GetRigidBodyB() == ctrl->GetRigidBody())))
                        {
-                               removeConstraint(int(p2p));
+                               removeConstraint(p2p);
                                //only 1 constraint per constroller
                                break;
                        }
@@ -773,13 +773,11 @@ int                       CcdPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl
        
 }
 
-void           CcdPhysicsEnvironment::removeConstraint(int constraintid)
+void           CcdPhysicsEnvironment::removeConstraint(void* p2p)
 {
-       
-       Point2PointConstraint* p2p = (Point2PointConstraint*) constraintid;
-       
        std::vector<Point2PointConstraint*>::iterator i =
-               std::find(m_p2pConstraints.begin(), m_p2pConstraints.end(), p2p);
+               std::find(m_p2pConstraints.begin(), m_p2pConstraints.end(), 
+                               (Point2PointConstraint *)p2p);
        
        if (!(i == m_p2pConstraints.end()) )
        {
index 329239db667f6a9b33a91ddde002e3b0822374c9..6050af2f3c8d5cc9162689d8e5ae9b7e74ec8c23 100644 (file)
@@ -75,7 +75,7 @@ class CcdPhysicsEnvironment : public PHY_IPhysicsEnvironment
                virtual int                     createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type,
                        float pivotX,float pivotY,float pivotZ,
                        float axisX,float axisY,float axisZ);
-               virtual void            removeConstraint(int constraintid);
+           virtual void                removeConstraint(void* constraintid);
 
 
                virtual PHY_IPhysicsController* rayTest(PHY_IPhysicsController* ignoreClient, float fromX,float fromY,float fromZ, float toX,float toY,float toZ, 
index a640acd9b3d66d489472604e27d7744bca820dd2..0b6f8a4ded4c09d7ef5488cbf4a104e344ad8932 100644 (file)
@@ -101,7 +101,7 @@ int                 DummyPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ct
 
 }
 
-void           DummyPhysicsEnvironment::removeConstraint(int constraintid)
+void           DummyPhysicsEnvironment::removeConstraint(void * constraintid)
 {
        if (constraintid)
        {
index fde27e822d6fe37d7ad08c8602a0694198794182..0a359feea6d4a9bdab0f28b38c4a4eb39d93119d 100644 (file)
@@ -61,7 +61,7 @@ public:
                        float pivotX,float pivotY,float pivotZ,
                        float axisX,float axisY,float axisZ);
 
-       virtual void            removeConstraint(int constraintid);
+       virtual void            removeConstraint(void * constraintid);
        virtual PHY_IPhysicsController* rayTest(PHY_IPhysicsController* ignoreClient, float fromX,float fromY,float fromZ, float toX,float toY,float toZ, 
                                                                        float& hitX,float& hitY,float& hitZ,float& normalX,float& normalY,float& normalZ);
 
index 6cd5d513357bbbb0797b7966b329d1c7ce0b69e3..8d03fd4b0f4b86b6ffb7acdbd70a5d8171cb065f 100644 (file)
@@ -117,7 +117,7 @@ int SumoPhysicsEnvironment::createConstraint(
        return constraintid;
 }
 
-void SumoPhysicsEnvironment::removeConstraint(int constraintid)
+void SumoPhysicsEnvironment::removeConstraint(void * constraintid)
 {
        if (constraintid)
        {
index 62672d8ba489a9f411c2377a8613d499cc6196b9..c93e34825b922e8b6c697d561bdde8bb189004f8 100644 (file)
@@ -66,7 +66,7 @@ public:
                        float pivotX,float pivotY,float pivotZ,
                        float axisX,float axisY,float axisZ);
 
-       virtual void            removeConstraint(int constraintid);
+       virtual void            removeConstraint(void * constraintid);
        virtual PHY_IPhysicsController* rayTest(PHY_IPhysicsController* ignoreClient,float fromX,float fromY,float fromZ, float toX,float toY,float toZ, 
                                                                        float& hitX,float& hitY,float& hitZ,float& normalX,float& normalY,float& normalZ);
 
index c847e638bce9c9664e8dc3e596d96255b5dbe75e..1158563527abc31073be40b50509aca2c32ce929 100644 (file)
@@ -83,7 +83,7 @@ class PHY_IPhysicsEnvironment
                virtual int                     createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type,
                        float pivotX,float pivotY,float pivotZ,
                        float axisX,float axisY,float axisZ)=0;
-               virtual void            removeConstraint(int constraintid)=0;
+               virtual void            removeConstraint(void * constraintid)=0;
 
                virtual PHY_IPhysicsController* rayTest(PHY_IPhysicsController* ignoreClient, float fromX,float fromY,float fromZ, float toX,float toY,float toZ, 
                                                                                float& hitX,float& hitY,float& hitZ,float& normalX,float& normalY,float& normalZ)=0;
index 8fabc9a551646a5e02d489131586e5228643abd0..51a8990540996d3e3bcb895f232f8aa6e405b73a 100644 (file)
 #ifndef __GEN_HASHEDPTR
 #define __GEN_HASHEDPTR
 
-unsigned int GEN_Hash(unsigned int inDWord);
+unsigned int GEN_Hash(void * inDWord);
 
 class GEN_HashedPtr
 {
        void* m_valptr;
 public:
        GEN_HashedPtr(void* val) : m_valptr(val) {};
-       unsigned int hash() const { return GEN_Hash((unsigned int) m_valptr);};
+       unsigned int hash() const { return GEN_Hash(m_valptr);};
        inline friend bool operator ==(const GEN_HashedPtr & rhs, const GEN_HashedPtr & lhs) { return rhs.m_valptr == lhs.m_valptr;};
 };