svn merge -r 21041:21301 https://svn.blender.org/svnroot/bf-blender/branches/blender2...
[blender.git] / source / gameengine / GameLogic / SCA_RandomActuator.cpp
index a722590dd10d05b36b60da2756d1081aafb41f24..e903d10f9a5927e57b71775b7a2aeafb55c49b00 100644 (file)
@@ -50,9 +50,8 @@ SCA_RandomActuator::SCA_RandomActuator(SCA_IObject *gameobj,
                                                                         SCA_RandomActuator::KX_RANDOMACT_MODE mode,
                                                                         float para1,
                                                                         float para2,
-                                                                        const STR_String &propName,
-                                                                        PyTypeObject* T)
-       : SCA_IActuator(gameobj, T),
+                                                                        const STR_String &propName)
+       : SCA_IActuator(gameobj),
          m_propname(propName),
          m_parameter1(para1),
          m_parameter2(para2),
@@ -332,19 +331,15 @@ PyTypeObject SCA_RandomActuator::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_RandomActuator::Parents[] = {
-       &SCA_RandomActuator::Type,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
        &SCA_IActuator::Type,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       0,0,0,0,0,0,
+       py_base_new
 };
 
 PyMethodDef SCA_RandomActuator::Methods[] = {
@@ -384,14 +379,14 @@ 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 PyInt_FromLong(act->m_base->GetSeed());
+       return PyLong_FromSsize_t(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 (PyInt_Check(value)) {
-               int ival = PyInt_AsLong(value);
+       if (PyLong_Check(value))        {
+               int ival = PyLong_AsSsize_t(value);
                act->m_base->SetSeed(ival);
                return PY_SET_ATTR_SUCCESS;
        } else {
@@ -400,19 +395,6 @@ int SCA_RandomActuator::pyattr_set_seed(void *self, const struct KX_PYATTRIBUTE_
        }
 }
 
-PyObject* SCA_RandomActuator::py_getattro(PyObject *attr) {
-       py_getattro_up(SCA_IActuator);
-}
-
-PyObject* SCA_RandomActuator::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IActuator);
-}
-
-int SCA_RandomActuator::py_setattro(PyObject *attr, PyObject *value)
-{
-       py_setattro_up(SCA_IActuator);
-}
-
 /* 1. setSeed                                                            */
 const char SCA_RandomActuator::SetSeed_doc[] = 
 "setSeed(seed)\n"
@@ -439,7 +421,7 @@ const char SCA_RandomActuator::GetSeed_doc[] =
 PyObject* SCA_RandomActuator::PyGetSeed()
 {
        ShowDeprecationWarning("getSeed()", "the seed property");
-       return PyInt_FromLong(m_base->GetSeed());
+       return PyLong_FromSsize_t(m_base->GetSeed());
 }
 
 /* 4. getPara1                                                           */
@@ -473,7 +455,7 @@ const char SCA_RandomActuator::GetDistribution_doc[] =
 PyObject* SCA_RandomActuator::PyGetDistribution()
 {
        ShowDeprecationWarning("getDistribution()", "the distribution property");
-       return PyInt_FromLong(m_distribution);
+       return PyLong_FromSsize_t(m_distribution);
 }
 
 /* 9. setProperty                                                        */
@@ -508,7 +490,7 @@ const char SCA_RandomActuator::GetProperty_doc[] =
 PyObject* SCA_RandomActuator::PyGetProperty()
 {
        ShowDeprecationWarning("getProperty()", "the 'propName' property");
-       return PyString_FromString(m_propname);
+       return PyUnicode_FromString(m_propname);
 }
 
 /* 11. setBoolConst */