py api cleanup, replace use...
- PyLong_FromSsize_t --> PyLong_FromLong - PyLong_AsSsize_t --> PyLong_AsLong In all places except for those where python api expects PySsize_t (index lookups mainly). - use PyBool_FromLong in a few areas of the BGE. - fix incorrect assumption in the BGE that PySequence_Check() means PySequence_Fast_ functions can be used.
This commit is contained in:
@@ -363,17 +363,17 @@ PyAttributeDef SCA_RandomActuator::Attributes[] = {
|
||||
PyObject *SCA_RandomActuator::pyattr_get_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
|
||||
{
|
||||
SCA_RandomActuator* act = static_cast<SCA_RandomActuator*>(self);
|
||||
return PyLong_FromSsize_t(act->m_base->GetSeed());
|
||||
return PyLong_FromLong(act->m_base->GetSeed());
|
||||
}
|
||||
|
||||
int SCA_RandomActuator::pyattr_set_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
|
||||
{
|
||||
SCA_RandomActuator* act = static_cast<SCA_RandomActuator*>(self);
|
||||
if (PyLong_Check(value)) {
|
||||
int ival = PyLong_AsSsize_t(value);
|
||||
act->m_base->SetSeed(ival);
|
||||
if (PyLong_Check(value)) {
|
||||
act->m_base->SetSeed(PyLong_AsLong(value));
|
||||
return PY_SET_ATTR_SUCCESS;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError, "actuator.seed = int: Random Actuator, expected an integer");
|
||||
return PY_SET_ATTR_FAIL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user