svn merge -r 21041:21301 https://svn.blender.org/svnroot/bf-blender/branches/blender2...
[blender.git] / source / gameengine / GameLogic / SCA_MouseSensor.cpp
index c5e1c3c0441f9086bc8412ea844f2e45b699c567..49fa19dce38832bfa6c9cb9d5016632b4007248c 100644 (file)
@@ -49,9 +49,8 @@
 SCA_MouseSensor::SCA_MouseSensor(SCA_MouseManager* eventmgr, 
                                                                 int startx,int starty,
                                                                 short int mousemode,
-                                                                SCA_IObject* gameobj, 
-                                                                PyTypeObject* T)
-    : SCA_ISensor(gameobj,eventmgr, T),
+                                                                SCA_IObject* gameobj)
+    : SCA_ISensor(gameobj,eventmgr),
        m_pMouseMgr(eventmgr),
        m_x(startx),
        m_y(starty)
@@ -254,7 +253,7 @@ const char SCA_MouseSensor::GetXPosition_doc[] =
 "\tpixels\n";
 PyObject* SCA_MouseSensor::PyGetXPosition() {
        ShowDeprecationWarning("getXPosition()", "the position property");
-       return PyInt_FromLong(m_x);
+       return PyLong_FromSsize_t(m_x);
 }
 
 /* get y position ---------------------------------------------------------- */
@@ -265,7 +264,7 @@ const char SCA_MouseSensor::GetYPosition_doc[] =
 "\tpixels\n";
 PyObject* SCA_MouseSensor::PyGetYPosition() {
        ShowDeprecationWarning("getYPosition()", "the position property");
-       return PyInt_FromLong(m_y);
+       return PyLong_FromSsize_t(m_y);
 }
 //<----- Deprecated
 
@@ -273,9 +272,9 @@ KX_PYMETHODDEF_DOC_O(SCA_MouseSensor, getButtonStatus,
 "getButtonStatus(button)\n"
 "\tGet the given button's status (KX_INPUT_NONE, KX_INPUT_NONE, KX_INPUT_JUST_ACTIVATED, KX_INPUT_ACTIVE, KX_INPUT_JUST_RELEASED).\n")
 {
-       if (PyInt_Check(value))
+       if (PyLong_Check(value))
        {
-               int button = PyInt_AsLong(value);
+               int button = PyLong_AsSsize_t(value);
                
                if ((button < SCA_IInputDevice::KX_LEFTMOUSE)
                        || (button > SCA_IInputDevice::KX_RIGHTMOUSE)){
@@ -285,7 +284,7 @@ KX_PYMETHODDEF_DOC_O(SCA_MouseSensor, getButtonStatus,
                
                SCA_IInputDevice* mousedev = m_pMouseMgr->GetInputDevice();
                const SCA_InputEvent& event = mousedev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) button);
-               return PyInt_FromLong(event.m_status);
+               return PyLong_FromSsize_t(event.m_status);
        }
        
        Py_RETURN_NONE;
@@ -312,19 +311,15 @@ PyTypeObject SCA_MouseSensor::Type = {
        0,
        0,
        py_base_repr,
-       0,0,0,0,0,0,
-       py_base_getattro,
-       py_base_setattro,
        0,0,0,0,0,0,0,0,0,
-       Methods
-};
-
-PyParentObject SCA_MouseSensor::Parents[] = {
-       &SCA_MouseSensor::Type,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
        &SCA_ISensor::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       0,0,0,0,0,0,
+       py_base_new
 };
 
 PyMethodDef SCA_MouseSensor::Methods[] = {
@@ -342,18 +337,4 @@ PyAttributeDef SCA_MouseSensor::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-PyObject* SCA_MouseSensor::py_getattro(PyObject *attr) 
-{
-       py_getattro_up(SCA_ISensor);
-}
-
-PyObject* SCA_MouseSensor::py_getattro_dict() {
-       py_getattro_dict_up(SCA_ISensor);
-}
-
-int SCA_MouseSensor::py_setattro(PyObject *attr, PyObject *value)
-{
-       py_setattro_up(SCA_ISensor);
-}
-
 /* eof */