[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20135] trunk/blender/source/gameengine/ Ketsji/KX_PythonSeq.cpp: use the same sequence mapping types as CListValue, hopefully this means it will build on different python versions

Campbell Barton ideasman42 at gmail.com
Mon May 11 00:33:21 CEST 2009


Revision: 20135
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20135
Author:   campbellbarton
Date:     2009-05-11 00:33:21 +0200 (Mon, 11 May 2009)

Log Message:
-----------
use the same sequence mapping types as CListValue, hopefully this means it will build on different python versions

Modified Paths:
--------------
    trunk/blender/source/gameengine/Ketsji/KX_PythonSeq.cpp

Modified: trunk/blender/source/gameengine/Ketsji/KX_PythonSeq.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_PythonSeq.cpp	2009-05-10 22:06:11 UTC (rev 20134)
+++ trunk/blender/source/gameengine/Ketsji/KX_PythonSeq.cpp	2009-05-10 22:33:21 UTC (rev 20135)
@@ -20,7 +20,7 @@
  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  * All rights reserved.
  *
- * The Original Code is: all of this file.
+ * The Original Code is: none of this file.
  *
  * Contributor(s): Campbell Barton
  *
@@ -52,26 +52,26 @@
 	PyObject_DEL( self );
 }
 
-static int KX_PythonSeq_len( KX_PythonSeq * self )
+static Py_ssize_t KX_PythonSeq_len( PyObject * self )
 {
-	PyObjectPlus *self_plus= BGE_PROXY_REF(self->base);
+	PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base);
 	 
 	if(self_plus==NULL) {
 		PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG);
 		return -1;
 	}
 	
-	switch(self->type) {
+	switch(((KX_PythonSeq *)self)->type) {
 	case KX_PYGENSEQ_CONT_TYPE_SENSORS:
-		return (int)(((SCA_IController *)self_plus)->GetLinkedSensors().size());
+		return ((SCA_IController *)self_plus)->GetLinkedSensors().size();
 	case KX_PYGENSEQ_CONT_TYPE_ACTUATORS:
-		return (int)(((SCA_IController *)self_plus)->GetLinkedActuators().size());
+		return ((SCA_IController *)self_plus)->GetLinkedActuators().size();
 	case KX_PYGENSEQ_OB_TYPE_SENSORS:
-		return (int)(((KX_GameObject *)self_plus)->GetSensors().size());
+		return ((KX_GameObject *)self_plus)->GetSensors().size();
 	case KX_PYGENSEQ_OB_TYPE_CONTROLLERS:
-		return (int)(((KX_GameObject *)self_plus)->GetControllers().size());
+		return ((KX_GameObject *)self_plus)->GetControllers().size();
 	case KX_PYGENSEQ_OB_TYPE_ACTUATORS:
-		return (int)(((KX_GameObject *)self_plus)->GetActuators().size());
+		return ((KX_GameObject *)self_plus)->GetActuators().size();
 	default:
 		/* Should never happen */
 		PyErr_SetString(PyExc_SystemError, "invalid type, internal error");
@@ -79,16 +79,16 @@
 	}
 }
 
-static PyObject *KX_PythonSeq_getIndex(KX_PythonSeq * self, int index)
+static PyObject *KX_PythonSeq_getIndex(PyObject* self, int index)
 {
-	PyObjectPlus *self_plus= BGE_PROXY_REF(self->base);
+	PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base);
 	 
 	if(self_plus==NULL) {
 		PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG);
 		return NULL;
 	}
 	
-	switch(self->type) {
+	switch(((KX_PythonSeq *)self)->type) {
 		case KX_PYGENSEQ_CONT_TYPE_SENSORS:
 		{
 			vector<SCA_ISensor*>& linkedsensors = ((SCA_IController *)self_plus)->GetLinkedSensors();
@@ -146,9 +146,9 @@
 }
 
 
-static PyObject * KX_PythonSeq_subscript(KX_PythonSeq * self, PyObject *key)
+static PyObject * KX_PythonSeq_subscript(PyObject * self, PyObject *key)
 {
-	PyObjectPlus *self_plus= BGE_PROXY_REF(self->base);
+	PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base);
 	char *name = NULL;
 	
 	if(self_plus==NULL) {
@@ -165,7 +165,7 @@
 		return NULL;
 	}
 	
-	switch(self->type) {
+	switch(((KX_PythonSeq *)self)->type) {
 		case KX_PYGENSEQ_CONT_TYPE_SENSORS:
 		{
 			vector<SCA_ISensor*>& linkedsensors = ((SCA_IController *)self_plus)->GetLinkedSensors();
@@ -228,8 +228,8 @@
 }
 
 static PyMappingMethods KX_PythonSeq_as_mapping = {
-	( inquiry ) KX_PythonSeq_len,	/* mp_length */
-	( binaryfunc ) KX_PythonSeq_subscript,	/* mp_subscript */
+	KX_PythonSeq_len,	/* mp_length */
+	KX_PythonSeq_subscript,	/* mp_subscript */
 	0,	/* mp_ass_subscript */
 };
 
@@ -238,7 +238,7 @@
  * Initialize the interator index
  */
 
-static PyObject *KX_PythonSeq_getIter( KX_PythonSeq * self )
+static PyObject *KX_PythonSeq_getIter(KX_PythonSeq *self)
 {
 	if(BGE_PROXY_REF(self->base)==NULL) {
 		PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG);
@@ -260,9 +260,9 @@
  * Return next KX_PythonSeq iter.
  */
  
-static PyObject *KX_PythonSeq_nextIter( KX_PythonSeq * self )
+static PyObject *KX_PythonSeq_nextIter(KX_PythonSeq *self)
 {
-	PyObject *object = KX_PythonSeq_getIndex(self, self->iter);
+	PyObject *object = KX_PythonSeq_getIndex((PyObject *)self, self->iter);
 	
 	self->iter++;
 	if( object==NULL ) {





More information about the Bf-blender-cvs mailing list