[wpdev-commits] wolfpack/python pycoord.cpp,1.21,1.22
Brought to you by:
rip,
thiagocorrea
From: Sebastian H. <dar...@us...> - 2004-09-15 01:25:56
|
Update of /cvsroot/wpdev/wolfpack/python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12938/python Modified Files: pycoord.cpp Log Message: Line of Sight work! Index: pycoord.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/python/pycoord.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** pycoord.cpp 14 Sep 2004 23:03:17 -0000 1.21 --- pycoord.cpp 15 Sep 2004 01:25:46 -0000 1.22 *************** *** 29,32 **** --- 29,34 ---- #include "../coord.h" #include "../walking.h" + #include "../items.h" + #include "../basechar.h" /* *************** *** 179,189 **** } ! extern bool lineOfSightNew(const Coord_cl &origin, const Coord_cl &target); static PyObject* wpCoord_lineofsightnew( wpCoord* self, PyObject* args ) { ! Coord_cl pos; ! if ( !PyArg_ParseTuple( args, "O&:coord.lineofsight(coord)", &PyConvertCoord, &pos ) ) return 0; if ( lineOfSightNew( self->coord, pos ) ) --- 181,211 ---- } ! extern bool lineOfSightNew(Coord_cl origin, Coord_cl target); ! extern void getAverageZ(const Coord_cl &pos, int &z, int &average, int &top); ! extern Coord_cl getItemLosCoord(P_ITEM pItem); ! extern Coord_cl getCharLosCoord(P_CHAR pChar, bool eye); static PyObject* wpCoord_lineofsightnew( wpCoord* self, PyObject* args ) { ! PyObject *object; ! if ( !PyArg_ParseTuple( args, "O:coord.lineofsight(obj)", &object ) ) return 0; + + Coord_cl pos; + + if (checkWpCoord(object)) { + pos = getWpCoord(object); + + // Get the average elevation + int bottom, average, top; + getAverageZ(pos, bottom, average, top); + + // Use the top + pos.z = top; + } else if ( checkWpItem(object) ) { + pos = getItemLosCoord(getWpItem(object)); + } else if ( checkWpChar(object) ) { + pos = getCharLosCoord(getWpChar(object), false); + } if ( lineOfSightNew( self->coord, pos ) ) |