Update of /cvsroot/wpdev/wolfpack/python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2037/python
Modified Files:
global.cpp
Log Message:
New wolfpack functions: playercount, npccount, accounts.count
Index: global.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/global.cpp,v
retrieving revision 1.140
retrieving revision 1.141
diff -C2 -d -r1.140 -r1.141
*** global.cpp 9 Jul 2004 10:55:57 -0000 1.140
--- global.cpp 16 Jul 2004 21:01:06 -0000 1.141
***************
*** 1384,1387 ****
--- 1384,1411 ----
/*
+ \function wolfpack.npccount
+ \return An integer value.
+ \description This function returns the number of registered NPCs in the world.
+ */
+ static PyObject* wpNpcCount( PyObject* self, PyObject* args )
+ {
+ Q_UNUSED( self );
+ Q_UNUSED( args );
+ return PyLong_FromLong( World::instance()->npcCount() );
+ }
+
+ /*
+ \function wolfpack.playercount
+ \return An integer value.
+ \description This function returns the number of registered player characters in the world.
+ */
+ static PyObject* wpPlayerCount( PyObject* self, PyObject* args )
+ {
+ Q_UNUSED( self );
+ Q_UNUSED( args );
+ return PyLong_FromLong( World::instance()->playerCount() );
+ }
+
+ /*
\function wolfpack.itemcount
\return An integer value.
***************
*** 1745,1748 ****
--- 1769,1774 ----
static PyMethodDef wpGlobal[] =
{
+ { "npccount", wpNpcCount, METH_VARARGS, 0 },
+ { "playercount", wpPlayerCount, METH_VARARGS, 0 },
{ "charbase", wpCharBase, METH_VARARGS, 0 },
{ "getoption", wpGetOption, METH_VARARGS, "Reads a string value from the database." },
***************
*** 1852,1855 ****
--- 1878,1890 ----
/*
+ \function wolfpack.accounts.count
+ \return An integer value.
+ \description This function returns the number of accounts on the server.
+ */
+ static PyObject *wpAccountsCount( PyObject *self, PyObject *args ) {
+ return PyInt_FromLong(Accounts::instance()->count());
+ }
+
+ /*
\function wolfpack.accounts.find
\param name A string containing the account name.
***************
*** 2033,2036 ****
--- 2068,2072 ----
static PyMethodDef wpAccounts[] =
{
+ { "count", wpAccountsCount, METH_VARARGS, "" },
{ "find", wpAccountsFind, METH_VARARGS, "Finds an account object." },
{ "list", wpAccountsList, METH_NOARGS, "Gets a list of Account names." },
|