From: Laszlo T. <ave...@us...> - 2004-05-07 16:54:27
|
Update of /cvsroot/gemrb/gemrb/gemrb/plugins/GUIScript In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13677 Modified Files: GUIScript.cpp Log Message: Added IsPlayerSelected guiscript function Index: GUIScript.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/GUIScript/GUIScript.cpp,v retrieving revision 1.162 retrieving revision 1.163 diff -C2 -d -r1.162 -r1.163 *** GUIScript.cpp 26 Apr 2004 20:51:52 -0000 1.162 --- GUIScript.cpp 7 May 2004 16:54:17 -0000 1.163 *************** *** 2403,2406 **** --- 2403,2426 ---- } + static PyObject* GemRB_IsPlayerSelected(PyObject * /*self*/, PyObject* args) + { + int PlayerSlot; + + if (!PyArg_ParseTuple( args, "i", &PlayerSlot )) { + printMessage( "GUIScript", "Syntax Error: IsPlayerSelected(Slot)\n", LIGHT_RED ); + return NULL; + } + Game *game = core->GetGame(); + if(!game) { + return NULL; + } + PlayerSlot = game->FindPlayer( PlayerSlot ); + Actor* MyActor = core->GetGame()->GetPC( PlayerSlot ); + if (!MyActor) { + return Py_BuildValue( "s", ""); + } + return Py_BuildValue("d", MyActor->IsSelected() ); + } + static PyObject* GemRB_GetPlayerPortrait(PyObject * /*self*/, PyObject* args) { *************** *** 3040,3043 **** --- 3060,3065 ---- {"GetPlayerStat", GemRB_GetPlayerStat, METH_VARARGS, "Queries a stat."}, + {"IsPlayerSelected", GemRB_IsPlayerSelected, METH_VARARGS, + "Returns true if the player was selected."}, {"GetPlayerPortrait", GemRB_GetPlayerPortrait, METH_VARARGS, "Queries the player portrait."}, |