From fe08da3b4c4097c87c4ee1ee02e9218aaaffde4b Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Sun, 19 Apr 2009 17:26:03 +0000 Subject: BGE: fix Pyfrom_id to work on w64. --- source/gameengine/Expressions/ListValue.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'source/gameengine/Expressions') diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp index 5bb1eb0aeb9..4e14ce35eb9 100644 --- a/source/gameengine/Expressions/ListValue.cpp +++ b/source/gameengine/Expressions/ListValue.cpp @@ -532,13 +532,7 @@ PyObject* CListValue::Pycount(PyObject* self, PyObject* value) 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,17 +540,14 @@ PyObject* CListValue::Pyfrom_id(PyObject* self, PyObject* value) int numelem = GetCount(); for (int i=0;i(m_pValueArray[i]->m_proxy) == id) + if (reinterpret_cast(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 -- cgit v1.2.3