BGE Py API

use PY_SET_ATTR_FAIL and PY_SET_ATTR_SUCCESS return values so the fake subclassing can know if a value failed to be set or if it was missing from the type. (with PY_SET_ATTR_MISSING)

Also noticed some other mistakes.
- KX_LightObject, setting the type didnt check for an int.
- KX_SoundActuator, didnt return an error when assigning an invalid orientation value
- KX_GameObject, worldOrientation didnt return an error value.
This commit is contained in:
Campbell Barton
2009-05-19 07:16:40 +00:00
parent 5bd4b25dd1
commit 1a16fb1953
16 changed files with 89 additions and 83 deletions

View File

@@ -236,10 +236,10 @@ int SCA_RandomSensor::pyattr_set_seed(void *self_v, const KX_PYATTRIBUTE_DEF *at
SCA_RandomSensor* self= static_cast<SCA_RandomSensor*>(self_v);
if (!PyInt_Check(value)) {
PyErr_SetString(PyExc_TypeError, "sensor.seed = int: Random Sensor, expected an integer");
return -1;
return PY_SET_ATTR_FAIL;
}
self->m_basegenerator->SetSeed(PyInt_AsLong(value));
return 0;
return PY_SET_ATTR_SUCCESS;
}
/* eof */