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:
@@ -250,17 +250,18 @@ KX_PYMETHODDEF_DOC_O(SCA_MouseSensor, getButtonStatus,
|
||||
{
|
||||
if (PyLong_Check(value))
|
||||
{
|
||||
int button = PyLong_AsSsize_t(value);
|
||||
SCA_IInputDevice::KX_EnumInputs button = (SCA_IInputDevice::KX_EnumInputs)PyLong_AsLong(value);
|
||||
|
||||
if ((button < SCA_IInputDevice::KX_LEFTMOUSE)
|
||||
|| (button > SCA_IInputDevice::KX_RIGHTMOUSE)) {
|
||||
if ((button < SCA_IInputDevice::KX_LEFTMOUSE) ||
|
||||
(button > SCA_IInputDevice::KX_RIGHTMOUSE))
|
||||
{
|
||||
PyErr_SetString(PyExc_ValueError, "sensor.getButtonStatus(int): Mouse Sensor, invalid button specified!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SCA_IInputDevice* mousedev = ((SCA_MouseManager *)m_eventmgr)->GetInputDevice();
|
||||
const SCA_InputEvent& event = mousedev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) button);
|
||||
return PyLong_FromSsize_t(event.m_status);
|
||||
const SCA_InputEvent& event = mousedev->GetEventValue(button);
|
||||
return PyLong_FromLong(event.m_status);
|
||||
}
|
||||
|
||||
Py_RETURN_NONE;
|
||||
|
Reference in New Issue
Block a user