[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19793] trunk/blender/source/gameengine/ Expressions/ListValue.cpp: BGE: fix Pyfrom_id to work on w64.

Benoit Bolsee benoit.bolsee at online.be
Sun Apr 19 19:26:03 CEST 2009


Revision: 19793
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19793
Author:   ben2610
Date:     2009-04-19 19:26:03 +0200 (Sun, 19 Apr 2009)

Log Message:
-----------
BGE: fix Pyfrom_id to work on w64.

Modified Paths:
--------------
    trunk/blender/source/gameengine/Expressions/ListValue.cpp

Modified: trunk/blender/source/gameengine/Expressions/ListValue.cpp
===================================================================
--- trunk/blender/source/gameengine/Expressions/ListValue.cpp	2009-04-19 17:12:16 UTC (rev 19792)
+++ trunk/blender/source/gameengine/Expressions/ListValue.cpp	2009-04-19 17:26:03 UTC (rev 19793)
@@ -532,13 +532,7 @@
 
 PyObject* CListValue::Pyfrom_id(PyObject* self, PyObject* value)
 {
-#if SIZEOF_VOID_P <= SIZEOF_LONG
-#define BGE_ID_TYPE unsigned long
-	BGE_ID_TYPE id= PyLong_AsUnsignedLong(value);
-#else
-#define BGE_ID_TYPE unsigned long long
-	BGE_ID_TYPE id= PyLong_FromUnsignedLongLong(value);
-#endif
+	uintptr_t id= (uintptr_t)PyLong_AsVoidPtr(value);
 	
 	if (PyErr_Occurred())
 		return NULL;
@@ -546,18 +540,15 @@
 	int numelem = GetCount();
 	for (int i=0;i<numelem;i++)
 	{
-		if (reinterpret_cast<BGE_ID_TYPE>(m_pValueArray[i]->m_proxy) == id)
+		if (reinterpret_cast<uintptr_t>(m_pValueArray[i]->m_proxy) == id)
 			return GetValue(i)->GetProxy();
-	
 	}
 	PyErr_SetString(PyExc_IndexError, "from_id(#), id not found in CValueList");
 	return NULL;	
 
 }
 
-#undef BGE_ID_TYPE
 
-
 /* --------------------------------------------------------------------- 
  * Some stuff taken from the header
  * --------------------------------------------------------------------- */





More information about the Bf-blender-cvs mailing list