BGE: fix Pyfrom_id to work on w64.
This commit is contained in:
parent
7f15445629
commit
fe08da3b4c
@ -532,13 +532,7 @@ PyObject* CListValue::Pycount(PyObject* self, PyObject* value)
|
|||||||
|
|
||||||
PyObject* CListValue::Pyfrom_id(PyObject* self, PyObject* value)
|
PyObject* CListValue::Pyfrom_id(PyObject* self, PyObject* value)
|
||||||
{
|
{
|
||||||
#if SIZEOF_VOID_P <= SIZEOF_LONG
|
uintptr_t id= (uintptr_t)PyLong_AsVoidPtr(value);
|
||||||
#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
|
|
||||||
|
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -546,17 +540,14 @@ PyObject* CListValue::Pyfrom_id(PyObject* self, PyObject* value)
|
|||||||
int numelem = GetCount();
|
int numelem = GetCount();
|
||||||
for (int i=0;i<numelem;i++)
|
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();
|
return GetValue(i)->GetProxy();
|
||||||
|
|
||||||
}
|
}
|
||||||
PyErr_SetString(PyExc_IndexError, "from_id(#), id not found in CValueList");
|
PyErr_SetString(PyExc_IndexError, "from_id(#), id not found in CValueList");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef BGE_ID_TYPE
|
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------
|
/* ---------------------------------------------------------------------
|
||||||
* Some stuff taken from the header
|
* Some stuff taken from the header
|
||||||
|
Loading…
Reference in New Issue
Block a user