Update of /cvsroot/wpdev/wolfpack/python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2442/python
Modified Files:
char.cpp gump.h pycoord.cpp pyregion.cpp regioniterator.h
skills.h target.h worlditerator.cpp
Log Message:
New documentation
Index: pyregion.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/pyregion.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** pyregion.cpp 2 Jun 2004 19:13:14 -0000 1.15
--- pyregion.cpp 29 Jun 2004 22:22:59 -0000 1.16
***************
*** 32,37 ****
#include <vector>
! /*!
! The object for Wolfpack Python items
*/
typedef struct
--- 32,38 ----
#include <vector>
! /*
! \object region
! \description This object type represents a region within the ultima online world.
*/
typedef struct
***************
*** 71,74 ****
--- 72,79 ----
static PyObject* wpRegion_getAttr( wpRegion* self, char* name )
{
+ /*
+ \rproperty region.parent This property represents the parent region of this region. If there is no parent region this
+ property contains None, otherwise another region object for the parent region.
+ */
if ( !strcmp( name, "parent" ) )
{
***************
*** 77,80 ****
--- 82,88 ----
return PyGetRegionObject( pRegion );
}
+ /*
+ \rproperty region.children This property contains a tuple of region objects for the subregions within this region.
+ */
else if ( !strcmp( name, "children" ) )
{
***************
*** 88,92 ****
return tuple;
}
! // Return a Tuple of Tuples
else if ( !strcmp( name, "rectangles" ) )
{
--- 96,103 ----
return tuple;
}
! /*
! \rproperty region.rectangles This property is a tuple of tuples containing x1, y1, x2 and y2 for the rectangles that define
! the area of this region.
! */
else if ( !strcmp( name, "rectangles" ) )
{
***************
*** 105,140 ****
return tuple;
}
else if ( !strcmp( name, "name" ) )
return QString2Python( self->pRegion->name() );
else if ( !strcmp( name, "midilist" ) )
return QString2Python( self->pRegion->midilist() );
else if ( !strcmp( name, "guardowner" ) )
return QString2Python( self->pRegion->guardOwner() );
- else if ( !strcmp( name, "rainchance" ) )
- return PyInt_FromLong( self->pRegion->rainChance() );
- else if ( !strcmp( name, "snowchance" ) )
- return PyInt_FromLong( self->pRegion->snowChance() );
// Flags
else if ( !strcmp( name, "guarded" ) )
return PyInt_FromLong( self->pRegion->isGuarded() ? 1 : 0 );
else if ( !strcmp( name, "nomark" ) )
return PyInt_FromLong( self->pRegion->isNoMark() ? 1 : 0 );
else if ( !strcmp( name, "nogate" ) )
return PyInt_FromLong( self->pRegion->isNoGate() ? 1 : 0 );
else if ( !strcmp( name, "norecallout" ) )
return PyInt_FromLong( self->pRegion->isNoRecallOut() ? 1 : 0 );
else if ( !strcmp( name, "norecallin" ) )
return PyInt_FromLong( self->pRegion->isNoRecallIn() ? 1 : 0 );
! else if ( !strcmp( name, "recallshield" ) )
! return PyInt_FromLong( self->pRegion->isRecallShield() ? 1 : 0 );
else if ( !strcmp( name, "noagressivemagic" ) )
return PyInt_FromLong( self->pRegion->isNoAgressiveMagic() ? 1 : 0 );
else if ( !strcmp( name, "antimagic" ) )
return PyInt_FromLong( self->pRegion->isAntiMagic() ? 1 : 0 );
! else if ( !strcmp( name, "validescortregion" ) )
! return PyInt_FromLong( self->pRegion->isValidEscortRegion() ? 1 : 0 );
else if ( !strcmp( name, "cave" ) )
return PyInt_FromLong( self->pRegion->isCave() ? 1 : 0 );
else if ( !strcmp( name, "nomusic" ) )
return PyInt_FromLong( self->pRegion->isNoMusic() ? 1 : 0 );
--- 116,179 ----
return tuple;
}
+ /*
+ \rproperty region.name The name of this region.
+ */
else if ( !strcmp( name, "name" ) )
return QString2Python( self->pRegion->name() );
+ /*
+ \rproperty region.midilist A list of midi sounds to be played for this region.
+ */
else if ( !strcmp( name, "midilist" ) )
return QString2Python( self->pRegion->midilist() );
+ /*
+ \rproperty region.guardowner The name of the guardowner for this region.
+ */
else if ( !strcmp( name, "guardowner" ) )
return QString2Python( self->pRegion->guardOwner() );
// Flags
+ /*
+ \rproperty region.guarded This boolean flag indicates whether the region is guarded or not.
+ */
else if ( !strcmp( name, "guarded" ) )
return PyInt_FromLong( self->pRegion->isGuarded() ? 1 : 0 );
+ /*
+ \rproperty region.nomark This boolean flag indicates whether runes aren't markable in this region or not.
+ */
else if ( !strcmp( name, "nomark" ) )
return PyInt_FromLong( self->pRegion->isNoMark() ? 1 : 0 );
+ /*
+ \rproperty region.nogate This boolean flag indicates whether gates in or out of this region are allowed.
+ */
else if ( !strcmp( name, "nogate" ) )
return PyInt_FromLong( self->pRegion->isNoGate() ? 1 : 0 );
+ /*
+ \rproperty region.norecallout This boolean flag indicates whether recalling out of this region is allowed.
+ */
else if ( !strcmp( name, "norecallout" ) )
return PyInt_FromLong( self->pRegion->isNoRecallOut() ? 1 : 0 );
+ /*
+ \rproperty region.norecallin This boolean flag indicates whether recalling into this region is allowed.
+ */
else if ( !strcmp( name, "norecallin" ) )
return PyInt_FromLong( self->pRegion->isNoRecallIn() ? 1 : 0 );
! /*
! \rproperty region.noagressivemagic This boolean flag indicates whether agressive magic is forbidden in this region or not.
! */
else if ( !strcmp( name, "noagressivemagic" ) )
return PyInt_FromLong( self->pRegion->isNoAgressiveMagic() ? 1 : 0 );
+ /*
+ \rproperty region.noagressivemagic This boolean flag indicates whether magic is forbidden in this region or not.
+ */
else if ( !strcmp( name, "antimagic" ) )
return PyInt_FromLong( self->pRegion->isAntiMagic() ? 1 : 0 );
! /*
! \rproperty region.cave This boolean flag indicates that this region is underground.
! */
else if ( !strcmp( name, "cave" ) )
return PyInt_FromLong( self->pRegion->isCave() ? 1 : 0 );
+ /*
+ \rproperty region.nomusic This boolean flag indicates that no music should be played in this region.
+ */
else if ( !strcmp( name, "nomusic" ) )
return PyInt_FromLong( self->pRegion->isNoMusic() ? 1 : 0 );
Index: target.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/target.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** target.h 2 Jun 2004 19:13:14 -0000 1.14
--- target.h 29 Jun 2004 22:22:59 -0000 1.15
***************
*** 33,36 ****
--- 33,40 ----
#include "../targetrequests.h"
+ /*
+ \object target
+ \description This object type represents the clients response to a target request.
+ */
typedef struct
{
***************
*** 43,50 ****
--- 47,65 ----
static PyObject* wpTarget_getAttr( wpTarget* self, char* name )
{
+ /*
+ \rproperty target.pos The value of this property is a <object id="coord">coord</object> object representing the location of the targetted object or ground tile.
+ Remember that this value should not be trusted.
+ */
if ( !strcmp( name, "pos" ) )
return PyGetCoordObject( self->pos );
+ /*
+ \rproperty target.model If a static tile has been targetted by the client, this property contains the art id of the targetted static tile. If a character has been targetted,
+ this property contains the body id of the targetted character. Please note that this value is sent by the client and not determined by the server.
+ */
else if ( !strcmp( name, "model" ) )
return PyInt_FromLong( self->model );
+ /*
+ \rproperty target.item If a valid item has been targetted, this property contains an <object id="item">item</object> object for the targetted item.
+ */
else if ( !strcmp( name, "item" ) )
{
***************
*** 52,55 ****
--- 67,73 ----
return PyGetItemObject( FindItemBySerial( self->object ) );
}
+ /*
+ \rproperty target.char If a valid character has been targetted, this property contains a <object id="char">char</object> object for the targetted character.
+ */
else if ( !strcmp( name, "char" ) )
if ( isCharSerial( self->object ) )
Index: char.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/char.cpp,v
retrieving revision 1.170
retrieving revision 1.171
diff -C2 -d -r1.170 -r1.171
*** char.cpp 7 Jun 2004 09:31:29 -0000 1.170
--- char.cpp 29 Jun 2004 22:22:59 -0000 1.171
***************
*** 2508,2512 ****
/*
! \rproperty char.region A <object id="REGION">REGION</object> object for the region the character is in.
May be None if the region the character is in is undefined.
This property is exclusive to python scripts and overrides normal properties with the same name.
--- 2508,2512 ----
/*
! \rproperty char.region A <object id="REGION">region</object> object for the region the character is in.
May be None if the region the character is in is undefined.
This property is exclusive to python scripts and overrides normal properties with the same name.
Index: regioniterator.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/regioniterator.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** regioniterator.h 2 Jun 2004 19:13:14 -0000 1.10
--- regioniterator.h 29 Jun 2004 22:22:59 -0000 1.11
***************
*** 33,36 ****
--- 33,46 ----
#include "../sectors.h"
+ /*
+ \object itemregioniterator
+ \description This object type allows you to iterate over a set of items in a memory efficient way.
+ A typical iteration could look like this:
+
+ <code>item = iterator.first
+ while item:
+ # Access item properties here
+ item = iterator.next</code>
+ */
typedef struct
{
***************
*** 47,52 ****
--- 57,70 ----
static PyObject* wpRegionIteratorItems_getAttr( wpRegionIteratorItems* self, char* name )
{
+ /*
+ \rproperty itemregioniterator.first Accessing this property will reset the iterator to the first item and return it.
+ If there are no items to iterate over, None is returned.
+ */
if ( !strcmp( name, "first" ) )
return PyGetItemObject( self->iter->first() );
+ /*
+ \rproperty itemregioniterator.next Accessing this property will advance the iterator to the next item and return it.
+ At the end of the iteration, None is returned.
+ */
else if ( !strcmp( name, "next" ) )
return PyGetItemObject( self->iter->next() );
***************
*** 59,63 ****
PyObject_HEAD_INIT( NULL )
0,
! "wpRegionIteratorItems",
sizeof( wpRegionIteratorItemsType ),
0,
--- 77,81 ----
PyObject_HEAD_INIT( NULL )
0,
! "wpItemRegionIterator",
sizeof( wpRegionIteratorItemsType ),
0,
***************
*** 91,95 ****
* Character Region Iterator
*/
!
typedef struct
{
--- 109,122 ----
* Character Region Iterator
*/
! /*
! \object charregioniterator
! \description This object type allows you to iterate over a set of chars in a memory efficient way.
! A typical iteration could look like this:
!
! <code>char = iterator.first
! while char:
! # Access char properties here
! char = iterator.next</code>
! */
typedef struct
{
***************
*** 106,111 ****
--- 133,146 ----
static PyObject* wpRegionIteratorChars_getAttr( wpRegionIteratorChars* self, char* name )
{
+ /*
+ \rproperty charregioniterator.first Accessing this property will reset the iterator to the first character and return it.
+ If there are no characters to iterate over, None is returned.
+ */
if ( !strcmp( name, "first" ) )
return PyGetCharObject( self->iter->first() );
+ /*
+ \rproperty charregioniterator.next Accessing this property will advance the iterator to the next character and return it.
+ At the end of the iteration, None is returned.
+ */
else if ( !strcmp( name, "next" ) )
return PyGetCharObject( self->iter->next() );
***************
*** 118,122 ****
PyObject_HEAD_INIT( NULL )
0,
! "wpRegionIteratorChars",
sizeof( wpRegionIteratorCharsType ),
0,
--- 153,157 ----
PyObject_HEAD_INIT( NULL )
0,
! "wpCharRegionIterator",
sizeof( wpRegionIteratorCharsType ),
0,
Index: worlditerator.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/worlditerator.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** worlditerator.cpp 29 Jun 2004 11:36:41 -0000 1.7
--- worlditerator.cpp 29 Jun 2004 22:22:59 -0000 1.8
***************
*** 29,32 ****
--- 29,44 ----
#include "../world.h"
+ /*
+ \object itemiterator
+ \description This object type allows you to iterate over all items
+ registered in the world in a memory efficient way. A typical iteration could look
+ like this:
+
+ <code>iterator = wolfpack.allitemsiterator()
+ item = iterator.first
+ while item:
+ # Access item properties here
+ item = iterator.next</code>
+ */
typedef struct {
PyObject_HEAD;
***************
*** 41,46 ****
--- 53,66 ----
static PyObject* wpItemIterator_getAttr( wpItemIterator* self, char* name )
{
+ /*
+ \rproperty itemiterator.first Accessing this property will reset the iterator to the first item and return it.
+ If there are no items to iterate over, None is returned.
+ */
if ( !strcmp( name, "first" ) )
return PyGetItemObject( self->iter->first() );
+ /*
+ \rproperty itemiterator.next Accessing this property will advance the iterator to the next item and return it.
+ At the end of the iteration, None is returned.
+ */
else if ( !strcmp( name, "next" ) )
return PyGetItemObject( self->iter->next() );
***************
*** 79,82 ****
--- 99,114 ----
*/
+ /*
+ \object chariterator
+ \description This object type allows you to iterate over all characters
+ registered in the world in a memory efficient way. A typical iteration could look
+ like this:
+
+ <code>iterator = wolfpack.allcharsiterator()
+ char = iterator.first
+ while char:
+ # Access char properties here
+ char = iterator.next</code>
+ */
typedef struct
{
***************
*** 93,98 ****
--- 125,138 ----
static PyObject* wpCharIterator_getAttr( wpCharIterator* self, char* name )
{
+ /*
+ \rproperty chariterator.first Accessing this property will reset the iterator to the first character and return it.
+ If there are no characters to iterate over, None is returned.
+ */
if ( !strcmp( name, "first" ) )
return PyGetCharObject( self->iter->first() );
+ /*
+ \rproperty chariterator.next Accessing this property will advance the iterator to the next character and return it.
+ At the end of the iteration, None is returned.
+ */
else if ( !strcmp( name, "next" ) )
return PyGetCharObject( self->iter->next() );
***************
*** 105,109 ****
PyObject_HEAD_INIT( NULL )
0,
! "wpIteratorChars",
sizeof( wpCharIteratorType ),
0,
--- 145,149 ----
PyObject_HEAD_INIT( NULL )
0,
! "wpCharIterator",
sizeof( wpCharIteratorType ),
0,
Index: skills.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/skills.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** skills.h 2 Jun 2004 19:13:14 -0000 1.18
--- skills.h 29 Jun 2004 22:22:59 -0000 1.19
***************
*** 105,109 ****
PyObject_HEAD_INIT( NULL )
0,
! "WPSkills",
sizeof( wpSkillsType ),
0,
--- 105,109 ----
PyObject_HEAD_INIT( NULL )
0,
! "wpSkills",
sizeof( wpSkillsType ),
0,
Index: pycoord.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/pycoord.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** pycoord.cpp 19 Jun 2004 07:37:53 -0000 1.14
--- pycoord.cpp 29 Jun 2004 22:22:59 -0000 1.15
***************
*** 30,35 ****
#include "../walking.h"
! /*!
! The object for Wolfpack Coord items
*/
typedef struct
--- 30,37 ----
#include "../walking.h"
! /*
! \object coord
! \description This object type represents a coordinate in the ultima online world.
! Use the coord function in the <module id="wolfpack">wolfpack</module> module to create an instance of this object type.
*/
typedef struct
***************
*** 60,63 ****
--- 62,74 ----
};
+ /*
+ \method coord.distance
+ \param pos A <object id="coord">coord</object> object.
+ \return An integer value.
+ \description This method measures the distance between this coordinate
+ and the given <object id="coord">coord</object> coord object.
+ The return value is -1 if the distance is infinite, otherwise the distance
+ in tiles is returned.
+ */
static PyObject* wpCoord_distance( wpCoord* self, PyObject* args )
{
***************
*** 76,79 ****
--- 87,97 ----
}
+ /*
+ \method coord.direction
+ \param pos A <object id="coord">coord</object> object.
+ \return An integer value.
+ \description This method calculates the direction from this coordinate to the
+ given one. If no direction can be determined, -1 is returned.
+ */
static PyObject* wpCoord_direction( wpCoord* self, PyObject* args )
{
***************
*** 92,95 ****
--- 110,119 ----
}
+ /*
+ \method coord.validspawnspot
+ \return A boolean value.
+ \description This method returns true if this coordinate is a valid spawn spot for a monster, character or item.
+ Otherwise it returns false.
+ */
static PyObject* wpCoord_validspawnspot( wpCoord* self, PyObject* args )
{
***************
*** 98,101 ****
--- 122,134 ----
}
+ /*
+ \method coord.lineofsight
+ \param coord Another <object id="coord">coord</object> object.
+ \param targetheight The height of the line of sight target.
+ Can be 0.
+ \param touch A boolean value. Defaults to false.
+ \description Returns true if an object at the given coordinate with the given height can be seen from this coordinate.
+ Touch determines whether the target needs to be touched or only be seen.
+ */
static PyObject* wpCoord_lineofsight( wpCoord* self, PyObject* args )
{
***************
*** 121,130 ****
--- 154,175 ----
static PyObject* wpCoord_getAttr( wpCoord* self, char* name )
{
+ /*
+ \property coord.x This is the x component of the coordinate.
+ */
if ( !strcmp( name, "x" ) )
return PyInt_FromLong( self->coord.x );
+ /*
+ \property coord.y This is the y component of the coordinate.
+ */
else if ( !strcmp( name, "y" ) )
return PyInt_FromLong( self->coord.y );
+ /*
+ \property coord.z This is the z component of the coordinate.
+ */
else if ( !strcmp( name, "z" ) )
return PyInt_FromLong( self->coord.z );
+ /*
+ \property coord.map This is the map this coordinate is on.
+ */
else if ( !strcmp( name, "map" ) )
return PyInt_FromLong( self->coord.map );
Index: gump.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/gump.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** gump.h 2 Jun 2004 19:13:14 -0000 1.18
--- gump.h 29 Jun 2004 22:22:59 -0000 1.19
***************
*** 47,52 ****
--- 47,61 ----
PyObject* wpGumpResponse_getAttr( wpGumpResponse* self, char* name )
{
+ /*
+ \rproperty gumpresponse.button This integer value is the id of the button that was pressed when the gump was closed.
+ If the gump was closed by rightclicking, the value of this property is 0.
+ */
if ( !strcmp( name, "button" ) )
return PyInt_FromLong( self->response->button );
+ /*
+ \rproperty gumpresponse.text This is a python dictionary. There is one entry for every textinput field on the
+ gump that was closed. The key for such an entry is the id of the corresponding textinput field. If your textinput
+ field had the id 5, you could access the text in that field when the gump was closed by using <code>response.text[5]</code>.
+ */
else if ( !strcmp( name, "text" ) )
{
***************
*** 66,69 ****
--- 75,86 ----
return dict;
}
+ /*
+ \rproperty gumpresponse.switches Unlike the text property this property is a list of integers for every enabled radiobox and
+ checkbox on the closed gump. Each integer value is an id of a checkbox or radiobutton. You can easily check if a checkbox with the
+ id 321 was checked on the gump by using this statement:
+
+ <code>if 321 in response.switches:
+ pass # Do something</code>
+ */
else if ( !strcmp( name, "switches" ) )
{
|