Update of /cvsroot/wpdev/wolfpack/python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11272/python
Modified Files:
char.cpp
Log Message:
bugfixes
Index: char.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/char.cpp,v
retrieving revision 1.201
retrieving revision 1.202
diff -C2 -d -r1.201 -r1.202
*** char.cpp 30 Sep 2004 19:58:52 -0000 1.201
--- char.cpp 1 Oct 2004 16:32:54 -0000 1.202
***************
*** 2463,2468 ****
--- 2463,2492 ----
}
+ /*
+ \method char.getopponents
+ \description This method returns a list of characters this character is fighting with.
+ \return A list of char objects.
+ */
+ static PyObject* wpChar_getopponents( wpChar* self, PyObject* args )
+ {
+ QPtrList<cFightInfo> &fights = self->pChar->fights();
+ PyObject *list = PyList_New(fights.count());
+ unsigned int i = 0;
+
+ for ( cFightInfo *fight = fights.first(); fight; fight = fights.next() )
+ {
+ if (fight->attacker() == self->pChar) {
+ PyList_SetItem(list, i++, fight->victim()->getPyObject());
+ } else {
+ PyList_SetItem(list, i++, fight->attacker()->getPyObject());
+ }
+ }
+
+ return list;
+ }
+
static PyMethodDef wpCharMethods[] =
{
+ { "getopponents", ( getattrofunc ) wpChar_getopponents, METH_VARARGS, "Get a list of characters this character is fighting at the moment." },
{ "moveto", ( getattrofunc ) wpChar_moveto, METH_VARARGS, "Moves the character to the specified location." },
{ "resurrect", ( getattrofunc ) wpChar_resurrect, METH_VARARGS, "Resurrects the character." },
|