[wpdev-commits] wolfpack/python global.cpp,1.94,1.95 target.h,1.8,1.9
Brought to you by:
rip,
thiagocorrea
|
From: <dar...@us...> - 2003-09-24 00:13:26
|
Update of /cvsroot/wpdev/wolfpack/python
In directory sc8-pr-cvs1:/tmp/cvs-serv13738/python
Modified Files:
global.cpp target.h
Log Message:
Fixed error reporting for python target requests.
Added wolfpack.console.log()
Gump Error Reporting to go and line breaks for the windows console.
Index: global.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/global.cpp,v
retrieving revision 1.94
retrieving revision 1.95
diff -C2 -d -r1.94 -r1.95
*** global.cpp 23 Sep 2003 12:40:19 -0000 1.94
--- global.cpp 24 Sep 2003 00:13:21 -0000 1.95
***************
*** 132,135 ****
--- 132,153 ----
/*!
+ Log a string
+ */
+ static PyObject* wpConsole_log( PyObject* self, PyObject* args )
+ {
+ Q_UNUSED(self);
+
+ char loglevel;
+ char *text;
+
+ if( !PyArg_ParseTuple( args, "bs:wolfpack.console.log( loglevel, text )", &loglevel, &text ) )
+ return 0;
+
+ Console::instance()->log( (eLogLevel)loglevel, text );
+
+ return PyTrue;
+ }
+
+ /*!
Sends a string to the wolfpack console.
*/
***************
*** 244,247 ****
--- 262,266 ----
{ "getbuffer", wpConsole_getbuffer, METH_NOARGS, "Gets the linebuffer of the console" },
{ "reloadScripts", wpConsole_reloadScripts, METH_NOARGS, "Reloads Scripts and Definitions" },
+ { "log", wpConsole_log, METH_VARARGS, NULL },
{ NULL, NULL, 0, NULL } // Terminator
};
Index: target.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/target.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** target.h 4 Aug 2003 07:28:18 -0000 1.8
--- target.h 24 Sep 2003 00:13:21 -0000 1.9
***************
*** 128,131 ****
--- 128,132 ----
{
PyObject *pFunc = PyObject_GetAttrString( pModule, const_cast< char* >( sFunction.latin1() ) );
+
if( pFunc && PyCallable_Check( pFunc ) )
{
***************
*** 136,145 ****
PyTuple_SetItem( p_args, 2, PyGetTarget( target, socket->player()->pos().map ) );
! PyEval_CallObject( pFunc, p_args );
!
! if( PyErr_Occurred() )
! PyErr_Print();
}
}
}
--- 137,149 ----
PyTuple_SetItem( p_args, 2, PyGetTarget( target, socket->player()->pos().map ) );
! PyObject *result = PyEval_CallObject( pFunc, p_args );
! Py_XDECREF( result );
! reportPythonError( sModule );
}
+
+ Py_XDECREF( pFunc );
}
+
+ Py_XDECREF( pModule );
}
***************
*** 162,165 ****
--- 166,170 ----
{
PyObject *pFunc = PyObject_GetAttrString( pModule, const_cast< char* >( sFunction.latin1() ) );
+
if( pFunc && PyCallable_Check( pFunc ) )
{
***************
*** 168,177 ****
PyTuple_SetItem( args, 0, PyGetCharObject( socket->player() ) );
! PyEval_CallObject( pFunc, args );
!
! if( PyErr_Occurred() )
! PyErr_Print();
}
}
}
--- 173,185 ----
PyTuple_SetItem( args, 0, PyGetCharObject( socket->player() ) );
! PyObject *result = PyEval_CallObject( pFunc, args );
! Py_XDECREF( result );
! reportPythonError( sModule );
}
+
+ Py_XDECREF( pFunc );
}
+
+ Py_XDECREF( pModule );
}
***************
*** 193,196 ****
--- 201,205 ----
{
PyObject *pFunc = PyObject_GetAttrString( pModule, const_cast< char* >( sFunction.latin1() ) );
+
if( pFunc && PyCallable_Check( pFunc ) )
{
***************
*** 199,208 ****
PyTuple_SetItem( args, 0, PyGetCharObject( socket->player() ) );
! PyEval_CallObject( pFunc, args );
! if( PyErr_Occurred() )
! PyErr_Print();
}
}
}
--- 208,221 ----
PyTuple_SetItem( args, 0, PyGetCharObject( socket->player() ) );
! PyObject *result = PyEval_CallObject( pFunc, args );
! Py_XDECREF( result );
! reportPythonError( sModule );
}
+
+ Py_XDECREF( pFunc );
}
+
+ Py_XDECREF( pModule );
}
|