rename and negate DISABLE_PYTHON --> WITH_PYTHON
[blender.git] / source / gameengine / Ketsji / KX_GameActuator.cpp
index 029f1f07861807bfa8d9b0ff1fcae47fec03697b..1a195913e4a707f855eb9192502b0d7de56b9d78 100644 (file)
@@ -17,7 +17,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  * All rights reserved.
@@ -36,9 +36,8 @@
 #include "KX_KetsjiEngine.h"
 #include "KX_PythonInit.h" /* for config load/saving */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include <stdio.h>
+#include <stdlib.h>
 
 /* ------------------------------------------------------------------------- */
 /* Native functions                                                          */
@@ -48,9 +47,9 @@ KX_GameActuator::KX_GameActuator(SCA_IObject *gameobj,
                                                                   int mode,
                                                                   const STR_String& filename,
                                                                   const STR_String& loadinganimationname,
-                                                                  KX_Scene* scene,
+                                                                  SCA_IScene* scene,
                                                                   KX_KetsjiEngine* ketsjiengine)
-                                                                  : SCA_IActuator(gameobj)
+                                                                  : SCA_IActuator(gameobj, KX_ACT_GAME)
 {
        m_mode = mode;
        m_filename = filename;
@@ -125,6 +124,7 @@ bool KX_GameActuator::Update()
                }
        case KX_GAME_SAVECFG:
                {
+#ifdef WITH_PYTHON
                        if (m_ketsjiengine)
                        {
                                char mashal_path[512];
@@ -152,9 +152,11 @@ bool KX_GameActuator::Update()
                                        delete [] marshal_buffer;
                        }
                        break;
+#endif // WITH_PYTHON
                }
        case KX_GAME_LOADCFG:
                {
+#ifdef WITH_PYTHON
                        if (m_ketsjiengine)
                        {
                                char mashal_path[512];
@@ -189,6 +191,7 @@ bool KX_GameActuator::Update()
                                }
                        }
                        break;
+#endif // WITH_PYTHON
                }
        default:
                ; /* do nothing? this is an internal error !!! */
@@ -198,8 +201,7 @@ bool KX_GameActuator::Update()
 }
 
 
-
-
+#ifdef WITH_PYTHON
 
 /* ------------------------------------------------------------------------- */
 /* Python functions                                                          */
@@ -207,40 +209,29 @@ bool KX_GameActuator::Update()
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject KX_GameActuator::Type = {
-#if (PY_VERSION_HEX >= 0x02060000)
        PyVarObject_HEAD_INIT(NULL, 0)
-#else
-       /* python 2.5 and below */
-       PyObject_HEAD_INIT( NULL )  /* required py macro */
-       0,                          /* ob_size */
-#endif
-               "KX_GameActuator",
-               sizeof(PyObjectPlus_Proxy),
-               0,
-               py_base_dealloc,
-               0,
-               0,
-               0,
-               0,
-               py_base_repr,
-               0,0,0,0,0,0,
-               NULL, //py_base_getattro,
-               NULL, //py_base_setattro,
-               0,
-               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-               0,0,0,0,0,0,0,
-               Methods,
-               0,
-               0,
-               &SCA_IActuator::Type
+       "KX_GameActuator",
+       sizeof(PyObjectPlus_Proxy),
+       0,
+       py_base_dealloc,
+       0,
+       0,
+       0,
+       0,
+       py_base_repr,
+       0,0,0,0,0,0,0,0,0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_IActuator::Type,
+       0,0,0,0,0,0,
+       py_base_new
 };
 
 PyMethodDef KX_GameActuator::Methods[] =
 {
-       // Deprecated ----->
-       {"getFile",     (PyCFunction) KX_GameActuator::sPyGetFile, METH_VARARGS, (PY_METHODCHAR)GetFile_doc},
-       {"setFile", (PyCFunction) KX_GameActuator::sPySetFile, METH_VARARGS, (PY_METHODCHAR)SetFile_doc},
-       // <-----
        {NULL,NULL} //Sentinel
 };
 
@@ -250,35 +241,4 @@ PyAttributeDef KX_GameActuator::Attributes[] = {
        { NULL }        //Sentinel
 };
 
-// Deprecated ----->
-/* getFile */
-const char KX_GameActuator::GetFile_doc[] = 
-"getFile()\n"
-"get the name of the file to start.\n";
-PyObject* KX_GameActuator::PyGetFile(PyObject* args, PyObject* kwds)
-{      
-       ShowDeprecationWarning("getFile()", "the fileName property");
-       return PyUnicode_FromString(m_filename);
-}
-
-/* setFile */
-const char KX_GameActuator::SetFile_doc[] =
-"setFile(name)\n"
-"set the name of the file to start.\n";
-PyObject* KX_GameActuator::PySetFile(PyObject* args, PyObject* kwds)
-{
-       char* new_file;
-
-       ShowDeprecationWarning("setFile()", "the fileName property");
-       
-       if (!PyArg_ParseTuple(args, "s:setFile", &new_file))
-       {
-               return NULL;
-       }
-       
-       m_filename = STR_String(new_file);
-
-       Py_RETURN_NONE;
-
-}
-// <-----      
+#endif // WITH_PYTHON