Undo revision 23130 which was a merge with 2.5, a messy one because I did something...
[blender.git] / source / gameengine / GameLogic / SCA_RandomSensor.cpp
index 890875e..a09d832 100644 (file)
@@ -152,6 +152,11 @@ PyTypeObject SCA_RandomSensor::Type = {
 };
 
 PyMethodDef SCA_RandomSensor::Methods[] = {
+       //Deprecated functions ----->
+       {"setSeed",     (PyCFunction) SCA_RandomSensor::sPySetSeed, METH_VARARGS, (const char *)SetSeed_doc},
+       {"getSeed",     (PyCFunction) SCA_RandomSensor::sPyGetSeed, METH_NOARGS, (const char *)GetSeed_doc},
+       {"getLastDraw", (PyCFunction) SCA_RandomSensor::sPyGetLastDraw, METH_NOARGS, (const char *)GetLastDraw_doc},
+       //<----- Deprecated
        {NULL,NULL} //Sentinel
 };
 
@@ -161,6 +166,45 @@ PyAttributeDef SCA_RandomSensor::Attributes[] = {
        {NULL} //Sentinel
 };
 
+/* 1. setSeed                                                            */
+const char SCA_RandomSensor::SetSeed_doc[] = 
+"setSeed(seed)\n"
+"\t- seed: integer\n"
+"\tSet the initial seed of the generator. Equal seeds produce\n"
+"\tequal series. If the seed is 0, the generator will produce\n"
+"\tthe same value on every call.\n";
+PyObject* SCA_RandomSensor::PySetSeed(PyObject* args) {
+       ShowDeprecationWarning("setSeed()", "the seed property");
+       long seedArg;
+       if(!PyArg_ParseTuple(args, "i:setSeed", &seedArg)) {
+               return NULL;
+       }
+       
+       m_basegenerator->SetSeed(seedArg);
+       
+       Py_RETURN_NONE;
+}
+
+/* 2. getSeed                                                            */
+const char SCA_RandomSensor::GetSeed_doc[] = 
+"getSeed()\n"
+"\tReturns the initial seed of the generator. Equal seeds produce\n"
+"\tequal series.\n";
+PyObject* SCA_RandomSensor::PyGetSeed() {
+       ShowDeprecationWarning("getSeed()", "the seed property");
+       return PyLong_FromSsize_t(m_basegenerator->GetSeed());
+}
+
+/* 3. getLastDraw                                                            */
+const char SCA_RandomSensor::GetLastDraw_doc[] = 
+"getLastDraw()\n"
+"\tReturn the last value that was drawn.\n";
+PyObject* SCA_RandomSensor::PyGetLastDraw() {
+       ShowDeprecationWarning("getLastDraw()", "the lastDraw property");
+       return PyLong_FromSsize_t(m_lastdraw);
+}
+
+
 PyObject* SCA_RandomSensor::pyattr_get_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        SCA_RandomSensor* self= static_cast<SCA_RandomSensor*>(self_v);