Update of /cvsroot/wpdev/wolfpack/python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29663/python
Modified Files:
char.cpp engine.cpp engine.h global.cpp item.cpp pycoord.cpp
pyregion.cpp regioniterator.h socket.cpp target.cpp target.h
tempeffect.h utilities.h
Log Message:
New sectors code and more. A changelog will be sent to the mailing list.
Index: utilities.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/utilities.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** utilities.h 30 Sep 2004 19:58:52 -0000 1.46
--- utilities.h 3 Nov 2004 02:09:33 -0000 1.47
***************
*** 38,42 ****
class cItem;
class cBaseChar;
! class Coord_cl;
class cAccount;
class cTerritory;
--- 38,42 ----
class cItem;
class cBaseChar;
! class Coord;
class cAccount;
class cTerritory;
***************
*** 78,84 ****
bool checkWpCoord( PyObject* object );
! int PyConvertCoord( PyObject* object, Coord_cl* pos );
! PyObject* PyGetCoordObject( const Coord_cl& coord );
! Coord_cl getWpCoord( PyObject* object );
bool checkWpItem( PyObject* object );
--- 78,84 ----
bool checkWpCoord( PyObject* object );
! int PyConvertCoord( PyObject* object, Coord* pos );
! PyObject* PyGetCoordObject( const Coord& coord );
! Coord getWpCoord( PyObject* object );
bool checkWpItem( PyObject* object );
Index: regioniterator.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/regioniterator.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** regioniterator.h 7 Sep 2004 03:21:50 -0000 1.15
--- regioniterator.h 3 Nov 2004 02:09:33 -0000 1.16
***************
*** 29,35 ****
#define __REGIONITERATOR_H__
- #include "../defines.h"
#include "utilities.h"
! #include "../sectors.h"
/*
--- 29,35 ----
#define __REGIONITERATOR_H__
#include "utilities.h"
! #include "../defines.h"
! #include "../mapobjects.h"
/*
***************
*** 46,55 ****
{
PyObject_HEAD;
! cItemSectorIterator* iter;
} wpRegionIteratorItems;
static void wpItemIteratorDealloc( PyObject* self )
{
! delete ( ( wpRegionIteratorItems * ) self )->iter;
PyObject_Del( self );
}
--- 46,55 ----
{
PyObject_HEAD;
! MapItemsIterator iter;
} wpRegionIteratorItems;
static void wpItemIteratorDealloc( PyObject* self )
{
! reinterpret_cast<wpRegionIteratorItems *>( self )->iter.~MapItemsIterator();
PyObject_Del( self );
}
***************
*** 62,66 ****
*/
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.
--- 62,66 ----
*/
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.
***************
*** 68,72 ****
*/
else if ( !strcmp( name, "next" ) )
! return PyGetItemObject( self->iter->next() );
Py_RETURN_FALSE;
--- 68,72 ----
*/
else if ( !strcmp( name, "next" ) )
! return PyGetItemObject( self->iter.next() );
Py_RETURN_FALSE;
***************
*** 75,107 ****
static PyTypeObject wpRegionIteratorItemsType =
{
! PyObject_HEAD_INIT( NULL )
! 0,
! "wpItemRegionIterator",
! sizeof( wpRegionIteratorItemsType ),
! 0,
! wpItemIteratorDealloc,
! 0,
! ( getattrfunc ) wpRegionIteratorItems_getAttr,
! 0,
! 0,
! 0,
! 0,
! 0,
! 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
static PyObject* PyGetItemRegionIterator( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, unsigned char map )
{
wpRegionIteratorItems* returnVal = PyObject_New( wpRegionIteratorItems, &wpRegionIteratorItemsType );
! returnVal->iter = SectorMaps::instance()->findItems( map, x1, y1, x2, y2 );
! return ( PyObject * ) returnVal;
}
static PyObject* PyGetItemRegionIterator( unsigned short xBlock, unsigned short yBlock, unsigned char map )
{
wpRegionIteratorItems* returnVal = PyObject_New( wpRegionIteratorItems, &wpRegionIteratorItemsType );
! returnVal->iter = SectorMaps::instance()->findItems( map, xBlock * 8, yBlock * 8 );
! return ( PyObject * ) returnVal;
}
--- 75,114 ----
static PyTypeObject wpRegionIteratorItemsType =
{
! PyObject_HEAD_INIT( NULL )
! 0,
! "wpItemRegionIterator",
! sizeof( wpRegionIteratorItemsType ),
! 0,
! wpItemIteratorDealloc,
! 0,
! ( getattrfunc ) wpRegionIteratorItems_getAttr,
! 0,
! 0,
! 0,
! 0,
! 0,
! 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
static PyObject* PyGetItemRegionIterator( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, unsigned char map )
{
+ // must manually initialize the iterator's state to zero
wpRegionIteratorItems* returnVal = PyObject_New( wpRegionIteratorItems, &wpRegionIteratorItemsType );
! *reinterpret_cast<void **>( &returnVal->iter ) = NULL;
! returnVal->iter = MapObjects::instance()->listItemsInRect( map, x1, y1, x2, y2 );
!
! return reinterpret_cast<PyObject *>( returnVal );
}
static PyObject* PyGetItemRegionIterator( unsigned short xBlock, unsigned short yBlock, unsigned char map )
{
+ // must manually initialize the iterator's state to zero
wpRegionIteratorItems* returnVal = PyObject_New( wpRegionIteratorItems, &wpRegionIteratorItemsType );
! *reinterpret_cast<void **>( &returnVal->iter ) = NULL;
!
! returnVal->iter = MapObjects::instance()->listItemsInBlock( map, xBlock * 8, yBlock * 8 );
!
! return reinterpret_cast<PyObject *>( returnVal );
}
***************
*** 122,131 ****
{
PyObject_HEAD;
! cCharSectorIterator* iter;
} wpRegionIteratorChars;
static void wpCharIteratorDealloc( PyObject* self )
{
! delete ( ( wpRegionIteratorChars * ) self )->iter;
PyObject_Del( self );
}
--- 129,138 ----
{
PyObject_HEAD;
! MapCharsIterator iter;
} wpRegionIteratorChars;
static void wpCharIteratorDealloc( PyObject* self )
{
! reinterpret_cast<wpRegionIteratorChars *>( self )->iter.~MapCharsIterator();
PyObject_Del( self );
}
***************
*** 138,142 ****
*/
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.
--- 145,149 ----
*/
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.
***************
*** 144,148 ****
*/
else if ( !strcmp( name, "next" ) )
! return PyGetCharObject( self->iter->next() );
Py_RETURN_FALSE;
--- 151,155 ----
*/
else if ( !strcmp( name, "next" ) )
! return PyGetCharObject( self->iter.next() );
Py_RETURN_FALSE;
***************
*** 151,183 ****
static PyTypeObject wpRegionIteratorCharsType =
{
! PyObject_HEAD_INIT( NULL )
! 0,
! "wpCharRegionIterator",
! sizeof( wpRegionIteratorCharsType ),
! 0,
! wpCharIteratorDealloc,
! 0,
! ( getattrfunc ) wpRegionIteratorChars_getAttr,
! 0,
! 0,
! 0,
! 0,
! 0,
! 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
! static PyObject* PyGetCharRegionIterator( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, unsigned char map, bool includeoffline = false )
{
wpRegionIteratorChars* returnVal = PyObject_New( wpRegionIteratorChars, &wpRegionIteratorCharsType );
! returnVal->iter = SectorMaps::instance()->findChars( map, x1, y1, x2, y2, includeoffline );
! return ( PyObject * ) returnVal;
}
! static PyObject* PyGetCharRegionIterator( unsigned short xBlock, unsigned short yBlock, unsigned char map, bool includeoffline = false )
{
wpRegionIteratorChars* returnVal = PyObject_New( wpRegionIteratorChars, &wpRegionIteratorCharsType );
! returnVal->iter = SectorMaps::instance()->findChars( map, xBlock * 8, yBlock * 8, includeoffline );
! return ( PyObject * ) returnVal;
}
--- 158,197 ----
static PyTypeObject wpRegionIteratorCharsType =
{
! PyObject_HEAD_INIT( NULL )
! 0,
! "wpCharRegionIterator",
! sizeof( wpRegionIteratorCharsType ),
! 0,
! wpCharIteratorDealloc,
! 0,
! ( getattrfunc ) wpRegionIteratorChars_getAttr,
! 0,
! 0,
! 0,
! 0,
! 0,
! 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
! static PyObject* PyGetCharRegionIterator( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, unsigned char map, bool offline = false )
{
+ // must manually initialize the iterator's state to zero
wpRegionIteratorChars* returnVal = PyObject_New( wpRegionIteratorChars, &wpRegionIteratorCharsType );
! *reinterpret_cast<void **>( &returnVal->iter ) = NULL;
! returnVal->iter = MapObjects::instance()->listCharsInRect( map, x1, y1, x2, y2, offline );
!
! return reinterpret_cast<PyObject *>( returnVal );
}
! static PyObject* PyGetCharRegionIterator( unsigned short xBlock, unsigned short yBlock, unsigned char map, bool offline = false )
{
+ // must manually initialize the iterator's state to zero
wpRegionIteratorChars* returnVal = PyObject_New( wpRegionIteratorChars, &wpRegionIteratorCharsType );
! *reinterpret_cast<void **>( &returnVal->iter ) = NULL;
!
! returnVal->iter = MapObjects::instance()->listCharsInBlock( map, xBlock * 8, yBlock * 8, offline );
!
! return reinterpret_cast<PyObject *>( returnVal );
}
Index: socket.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/socket.cpp,v
retrieving revision 1.90
retrieving revision 1.91
diff -C2 -d -r1.90 -r1.91
*** socket.cpp 18 Oct 2004 12:09:53 -0000 1.90
--- socket.cpp 3 Nov 2004 02:09:33 -0000 1.91
***************
*** 691,699 ****
cVariant value = self->pSock->tags().get( key );
! if ( value.type() == cVariant::String )
return QString2Python(value.toString());
! else if ( value.type() == cVariant::Int )
return PyInt_FromLong( value.asInt() );
! else if ( value.type() == cVariant::Double )
return PyFloat_FromDouble( value.asDouble() );
--- 691,699 ----
cVariant value = self->pSock->tags().get( key );
! if ( value.type() == cVariant::StringType )
return QString2Python(value.toString());
! else if ( value.type() == cVariant::IntType )
return PyInt_FromLong( value.asInt() );
! else if ( value.type() == cVariant::DoubleType )
return PyFloat_FromDouble( value.asDouble() );
Index: pycoord.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/pycoord.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** pycoord.cpp 9 Oct 2004 01:17:50 -0000 1.27
--- pycoord.cpp 3 Nov 2004 02:09:33 -0000 1.28
***************
*** 43,47 ****
{
PyObject_HEAD;
! Coord_cl coord;
} wpCoord;
--- 43,47 ----
{
PyObject_HEAD;
! Coord coord;
} wpCoord;
***************
*** 49,53 ****
static PyObject* wpCoord_str( wpCoord* object )
{
! const Coord_cl &pos = object->coord;
return PyString_FromFormat( "%i,%i,%i,%i", pos.x, pos.y, ( int ) pos.z, pos.map );
}
--- 49,53 ----
static PyObject* wpCoord_str( wpCoord* object )
{
! const Coord &pos = object->coord;
return PyString_FromFormat( "%i,%i,%i,%i", pos.x, pos.y, ( int ) pos.z, pos.map );
}
***************
*** 89,94 ****
return -1;
! const Coord_cl &posa = ( ( wpCoord* ) a )->coord;
! const Coord_cl &posb = ( ( wpCoord* ) b )->coord;
if ( posa.x != posb.x || posa.y != posb.y || posa.z != posb.z || posa.map != posb.map )
--- 89,94 ----
return -1;
! const Coord &posa = ( ( wpCoord* ) a )->coord;
! const Coord &posb = ( ( wpCoord* ) b )->coord;
if ( posa.x != posb.x || posa.y != posb.y || posa.z != posb.z || posa.map != posb.map )
***************
*** 120,124 ****
else
{
! Coord_cl pos = getWpCoord( PyTuple_GetItem( args, 0 ) );
// Calculate the distance
--- 120,124 ----
else
{
! Coord pos = getWpCoord( PyTuple_GetItem( args, 0 ) );
// Calculate the distance
***************
*** 143,147 ****
else
{
! Coord_cl pos = getWpCoord( PyTuple_GetItem( args, 0 ) );
// Calculate the distance
--- 143,147 ----
else
{
! Coord pos = getWpCoord( PyTuple_GetItem( args, 0 ) );
// Calculate the distance
***************
*** 172,176 ****
static PyObject* wpCoord_lineofsight( wpCoord* self, PyObject* args )
{
! Coord_cl pos;
char debug = 0;
if ( !PyArg_ParseTuple( args, "O&|b:coord.lineofsight(coord, [debug=0])", &PyConvertCoord, &pos, &debug ) )
--- 172,176 ----
static PyObject* wpCoord_lineofsight( wpCoord* self, PyObject* args )
{
! Coord pos;
char debug = 0;
if ( !PyArg_ParseTuple( args, "O&|b:coord.lineofsight(coord, [debug=0])", &PyConvertCoord, &pos, &debug ) )
***************
*** 297,301 ****
}
! int PyConvertCoord( PyObject* object, Coord_cl* pos )
{
if ( object->ob_type != &wpCoordType )
--- 297,301 ----
}
! int PyConvertCoord( PyObject* object, Coord* pos )
{
if ( object->ob_type != &wpCoordType )
***************
*** 314,318 ****
}
! PyObject* PyGetCoordObject( const Coord_cl& coord )
{
wpCoord* cObject = PyObject_New( wpCoord, &wpCoordType );
--- 314,318 ----
}
! PyObject* PyGetCoordObject( const Coord& coord )
{
wpCoord* cObject = PyObject_New( wpCoord, &wpCoordType );
***************
*** 321,327 ****
}
! Coord_cl getWpCoord( PyObject* object )
{
! Coord_cl coord;
if ( object->ob_type == &wpCoordType )
--- 321,327 ----
}
! Coord getWpCoord( PyObject* object )
{
! Coord coord;
if ( object->ob_type == &wpCoordType )
Index: tempeffect.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/tempeffect.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** tempeffect.h 25 Sep 2004 02:03:22 -0000 1.32
--- tempeffect.h 3 Nov 2004 02:09:33 -0000 1.33
***************
*** 219,223 ****
cVariant(pItem).serialize(writer, version);
} else if ( checkWpCoord( object ) ) {
! Coord_cl coord = getWpCoord(object);
cVariant(coord).serialize(writer, version);
}
--- 219,223 ----
cVariant(pItem).serialize(writer, version);
} else if ( checkWpCoord( object ) ) {
! Coord coord = getWpCoord(object);
cVariant(coord).serialize(writer, version);
}
***************
*** 240,268 ****
variant.serialize(reader, version);
switch (variant.type()) {
! case cVariant::Long:
! case cVariant::Int:
object = PyInt_FromLong(variant.asInt());
break;
! case cVariant::String:
object = QString2Python(variant.asString());
break;
! case cVariant::Double:
object = PyFloat_FromDouble(variant.asDouble());
break;
! case cVariant::BaseChar:
object = PyGetCharObject(variant.toChar());
break;
! case cVariant::Item:
object = PyGetItemObject(variant.toItem());
break;
! case cVariant::Coord:
object = PyGetCoordObject(variant.toCoord());
break;
! case cVariant::Invalid:
break;
}
--- 240,268 ----
variant.serialize(reader, version);
switch (variant.type()) {
! case cVariant::LongType:
! case cVariant::IntType:
object = PyInt_FromLong(variant.asInt());
break;
! case cVariant::StringType:
object = QString2Python(variant.asString());
break;
! case cVariant::DoubleType:
object = PyFloat_FromDouble(variant.asDouble());
break;
! case cVariant::BaseCharType:
object = PyGetCharObject(variant.toChar());
break;
! case cVariant::ItemType:
object = PyGetItemObject(variant.toItem());
break;
! case cVariant::CoordType:
object = PyGetCoordObject(variant.toCoord());
break;
! case cVariant::InvalidType:
break;
}
Index: target.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/target.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** target.cpp 25 Sep 2004 02:03:22 -0000 1.3
--- target.cpp 3 Nov 2004 02:09:33 -0000 1.4
***************
*** 93,97 ****
wpTarget* returnVal = PyObject_New( wpTarget, &wpTargetType );
! Coord_cl pos;
pos.x = target->x();
pos.y = target->y();
--- 93,97 ----
wpTarget* returnVal = PyObject_New( wpTarget, &wpTargetType );
! Coord pos;
pos.x = target->x();
pos.y = target->y();
Index: item.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/item.cpp,v
retrieving revision 1.141
retrieving revision 1.142
diff -C2 -d -r1.141 -r1.142
*** item.cpp 2 Nov 2004 20:45:46 -0000 1.141
--- item.cpp 3 Nov 2004 02:09:33 -0000 1.142
***************
*** 56,60 ****
};
! typedef SingletonHolder<cItemObjectCache> ItemCache;
// Forward Declarations
--- 56,60 ----
};
! typedef Singleton<cItemObjectCache> ItemCache;
// Forward Declarations
***************
*** 191,195 ****
{
// Gather parameters
! Coord_cl pos = self->pItem->pos();
uchar noRemove = 0;
--- 191,195 ----
{
// Gather parameters
! Coord pos = self->pItem->pos();
uchar noRemove = 0;
***************
*** 295,299 ****
else if ( PyTuple_Size( args ) >= 2 ) // Min 2
{
! Coord_cl pos = self->pItem->pos();
if ( !PyInt_Check( PyTuple_GetItem( args, 0 ) ) || !PyInt_Check( PyTuple_GetItem( args, 1 ) ) )
--- 295,299 ----
else if ( PyTuple_Size( args ) >= 2 ) // Min 2
{
! Coord pos = self->pItem->pos();
if ( !PyInt_Check( PyTuple_GetItem( args, 0 ) ) || !PyInt_Check( PyTuple_GetItem( args, 1 ) ) )
***************
*** 396,404 ****
cVariant value = self->pItem->getTag( key );
! if ( value.type() == cVariant::String )
return QString2Python(value.toString());
! else if ( value.type() == cVariant::Int )
return PyInt_FromLong( value.asInt() );
! else if ( value.type() == cVariant::Double )
return PyFloat_FromDouble( value.asDouble() );
--- 396,404 ----
cVariant value = self->pItem->getTag( key );
! if ( value.type() == cVariant::StringType )
return QString2Python(value.toString());
! else if ( value.type() == cVariant::IntType )
return PyInt_FromLong( value.asInt() );
! else if ( value.type() == cVariant::DoubleType )
return PyFloat_FromDouble( value.asDouble() );
***************
*** 552,556 ****
object = getArgItem( 1 );
! Coord_cl pos;
if ( checkArgCoord( 1 ) )
--- 552,556 ----
object = getArgItem( 1 );
! Coord pos;
if ( checkArgCoord( 1 ) )
Index: global.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/global.cpp,v
retrieving revision 1.168
retrieving revision 1.169
diff -C2 -d -r1.168 -r1.169
*** global.cpp 21 Oct 2004 21:58:05 -0000 1.168
--- global.cpp 3 Nov 2004 02:09:32 -0000 1.169
***************
*** 36,40 ****
#include "../uotime.h"
#include "../timers.h"
! #include "../sectors.h"
#include "../territories.h"
#include "../muls/maps.h"
--- 36,40 ----
#include "../uotime.h"
#include "../timers.h"
! #include "../mapobjects.h"
#include "../territories.h"
#include "../muls/maps.h"
***************
*** 378,382 ****
{
char* definition;
! Coord_cl pos;
if ( !PyArg_ParseTuple( args, "sO&:wolfpack.addnpc(def, pos)", &definition, &PyConvertCoord, &pos ) )
--- 378,382 ----
{
char* definition;
! Coord pos;
if ( !PyArg_ParseTuple( args, "sO&:wolfpack.addnpc(def, pos)", &definition, &PyConvertCoord, &pos ) )
***************
*** 476,480 ****
static PyObject* wpFindmulti( PyObject* /*self*/, PyObject* args )
{
! Coord_cl coord;
if ( !PyArg_ParseTuple( args, "O&:wolfpack.findmulti(pos)", &PyConvertCoord, &coord ) )
--- 476,480 ----
static PyObject* wpFindmulti( PyObject* /*self*/, PyObject* args )
{
! Coord coord;
if ( !PyArg_ParseTuple( args, "O&:wolfpack.findmulti(pos)", &PyConvertCoord, &coord ) )
***************
*** 647,651 ****
y = maxY - 1;
! StaticsIterator iter = Maps::instance()->staticsIterator( Coord_cl( x, y, 0, map ), exact );
PyObject* list = PyList_New( 0 );
--- 647,651 ----
y = maxY - 1;
! StaticsIterator iter = Maps::instance()->staticsIterator( Coord( x, y, 0, map ), exact );
PyObject* list = PyList_New( 0 );
***************
*** 719,732 ****
return 0;
! Coord_cl pos( x, y, 0, map );
! RegionIterator4Items iter( pos, range );
PyObject* list = PyList_New( 0 );
! for ( iter.Begin(); !iter.atEnd(); iter++ )
{
! P_ITEM pItem = iter.GetData();
!
! if ( pItem )
! PyList_Append( list, PyGetItemObject( pItem ) );
}
--- 719,729 ----
return 0;
! Coord pos( x, y, 0, map );
! MapItemsIterator iter = MapObjects::instance()->listItemsInCircle( pos, range );
PyObject* list = PyList_New( 0 );
! for ( P_ITEM pItem = iter.first(); pItem; pItem = iter.next() )
{
! PyList_Append( list, PyGetItemObject( pItem ) );
}
***************
*** 759,772 ****
return 0;
! Coord_cl pos( x, y, 0, map );
! cCharSectorIterator *iter = SectorMaps::instance()->findChars(pos, range, PyObject_IsTrue(offline) != 0);
!
PyObject* list = PyList_New( 0 );
! for ( P_CHAR pChar = iter->first(); pChar; pChar = iter->next() ) {
PyList_Append( list, pChar->getPyObject() );
}
- delete iter;
-
return list;
}
--- 756,767 ----
return 0;
! MapCharsIterator iter = MapObjects::instance()->listCharsInCircle( map, x, y, range, PyObject_IsTrue(offline) != 0 );
!
PyObject* list = PyList_New( 0 );
! for ( P_CHAR pChar = iter.first(); pChar; pChar = iter.next() )
! {
PyList_Append( list, pChar->getPyObject() );
}
return list;
}
***************
*** 781,785 ****
*/
static PyObject *wpCanPlace( PyObject* self, PyObject *args ) {
! Coord_cl pos;
unsigned short multiid;
unsigned short yard;
--- 776,780 ----
*/
static PyObject *wpCanPlace( PyObject* self, PyObject *args ) {
! Coord pos;
unsigned short multiid;
unsigned short yard;
***************
*** 839,843 ****
effect.setSpeed( getArgInt( 2 ) );
! Coord_cl displaypos = getArgCoord( 1 );
cUOSocket* mSock;
--- 834,838 ----
effect.setSpeed( getArgInt( 2 ) );
! Coord displaypos = getArgCoord( 1 );
cUOSocket* mSock;
***************
*** 874,878 ****
return 0;
! map_st mTile = Maps::instance()->seekMap( Coord_cl( x, y, 0, map ) );
PyObject* dict = PyDict_New();
--- 869,873 ----
return 0;
! map_st mTile = Maps::instance()->seekMap( Coord( x, y, 0, map ) );
PyObject* dict = PyDict_New();
***************
*** 1183,1187 ****
return 0;
! Coord_cl pos( x, y, z, map );
return PyGetCoordObject( pos );
--- 1178,1182 ----
return 0;
! Coord pos( x, y, z, map );
return PyGetCoordObject( pos );
Index: engine.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/engine.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** engine.h 10 Aug 2004 03:27:52 -0000 1.20
--- engine.h 3 Nov 2004 02:09:32 -0000 1.21
***************
*** 96,100 ****
};
! typedef SingletonHolder<cPythonEngine> PythonEngine;
void registerCleanupHandler( fnCleanupHandler );
--- 96,100 ----
};
! typedef Singleton<cPythonEngine> PythonEngine;
void registerCleanupHandler( fnCleanupHandler );
Index: target.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/target.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** target.h 25 Sep 2004 02:03:22 -0000 1.25
--- target.h 3 Nov 2004 02:09:33 -0000 1.26
***************
*** 40,44 ****
{
PyObject_HEAD;
! Coord_cl pos;
Q_UINT16 model;
SERIAL object;
--- 40,44 ----
{
PyObject_HEAD;
! Coord pos;
Q_UINT16 model;
SERIAL object;
Index: char.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/char.cpp,v
retrieving revision 1.204
retrieving revision 1.205
diff -C2 -d -r1.204 -r1.205
*** char.cpp 12 Oct 2004 23:59:28 -0000 1.204
--- char.cpp 3 Nov 2004 02:09:32 -0000 1.205
***************
*** 44,48 ****
#include "utilities.h"
! #include "content.h"
#include "tempeffect.h"
#include "objectcache.h"
--- 44,48 ----
#include "utilities.h"
! #include "pycontent.h"
#include "tempeffect.h"
#include "objectcache.h"
***************
*** 304,308 ****
// Gather parameters
! Coord_cl pos = self->pChar->pos();
if ( PyTuple_Size( args ) <= 1 )
--- 304,308 ----
// Gather parameters
! Coord pos = self->pChar->pos();
if ( PyTuple_Size( args ) <= 1 )
***************
*** 441,445 ****
else if ( PyTuple_Size( args ) >= 2 ) // Min 2
{
! Coord_cl pos = self->pChar->pos();
if ( !PyInt_Check( PyTuple_GetItem( args, 0 ) ) || !PyInt_Check( PyTuple_GetItem( args, 1 ) ) )
--- 441,445 ----
else if ( PyTuple_Size( args ) >= 2 ) // Min 2
{
! Coord pos = self->pChar->pos();
if ( !PyInt_Check( PyTuple_GetItem( args, 0 ) ) || !PyInt_Check( PyTuple_GetItem( args, 1 ) ) )
***************
*** 502,507 ****
if ( checkWpCoord( pObj ) )
{
! Coord_cl pos = getWpCoord( pObj );
! return PyInt_FromLong( self->pChar->pos().direction( Coord_cl( pos.x, pos.y ) ) );
}
--- 502,507 ----
if ( checkWpCoord( pObj ) )
{
! Coord pos = getWpCoord( pObj );
! return PyInt_FromLong( self->pChar->pos().direction( Coord( pos.x, pos.y ) ) );
}
***************
*** 517,521 ****
else if ( PyTuple_Size( args ) >= 2 ) // Min 2
{
! Coord_cl pos = self->pChar->pos();
if ( !PyInt_Check( PyTuple_GetItem( args, 0 ) ) || !PyInt_Check( PyTuple_GetItem( args, 1 ) ) )
--- 517,521 ----
else if ( PyTuple_Size( args ) >= 2 ) // Min 2
{
! Coord pos = self->pChar->pos();
if ( !PyInt_Check( PyTuple_GetItem( args, 0 ) ) || !PyInt_Check( PyTuple_GetItem( args, 1 ) ) )
***************
*** 968,976 ****
cVariant value = self->pChar->getTag( key );
! if ( value.type() == cVariant::String )
return QString2Python(value.toString());
! else if ( value.type() == cVariant::Int )
return PyInt_FromLong( value.asInt() );
! else if ( value.type() == cVariant::Double )
return PyFloat_FromDouble( value.asDouble() );
--- 968,976 ----
cVariant value = self->pChar->getTag( key );
! if ( value.type() == cVariant::StringType )
return QString2Python(value.toString());
! else if ( value.type() == cVariant::IntType )
return PyInt_FromLong( value.asInt() );
! else if ( value.type() == cVariant::DoubleType )
return PyFloat_FromDouble( value.asDouble() );
***************
*** 1275,1279 ****
if ( checkArgCoord( 0 ) )
{
! Coord_cl pos = getArgCoord( 0 );
self->pChar->turnTo( pos );
Py_RETURN_NONE;
--- 1275,1279 ----
if ( checkArgCoord( 0 ) )
{
! Coord pos = getArgCoord( 0 );
self->pChar->turnTo( pos );
Py_RETURN_NONE;
***************
*** 1459,1463 ****
if ( checkWpCoord( target ) )
{
! Coord_cl coord = getWpCoord( target );
self->pChar->effect( id, coord, fixedDirection, explodes, speed, hue, renderMode );
}
--- 1459,1463 ----
if ( checkWpCoord( target ) )
{
! Coord coord = getWpCoord( target );
self->pChar->effect( id, coord, fixedDirection, explodes, speed, hue, renderMode );
}
***************
*** 1735,1744 ****
}
! //if( !mayWalk( self->pChar, Coord_cl( getArgInt( 0 ), getArgInt( 1 ), getArgInt( 2 ), getArgInt( 3 ) ) ) )
int argx = getArgInt( 0 );
int argy = getArgInt( 1 );
int argz = getArgInt( 2 );
int argmap = getArgInt( 3 );
! Coord_cl argcoord( argx, argy, argz, argmap );
if ( !mayWalk( self->pChar, argcoord ) )
Py_RETURN_FALSE;
--- 1735,1744 ----
}
! //if( !mayWalk( self->pChar, Coord( getArgInt( 0 ), getArgInt( 1 ), getArgInt( 2 ), getArgInt( 3 ) ) ) )
int argx = getArgInt( 0 );
int argy = getArgInt( 1 );
int argz = getArgInt( 2 );
int argmap = getArgInt( 3 );
! Coord argcoord( argx, argy, argz, argmap );
if ( !mayWalk( self->pChar, argcoord ) )
Py_RETURN_FALSE;
***************
*** 1918,1922 ****
}
! Coord_cl pos = getArgCoord( 0 );
if ( pos.map != self->pChar->pos().map )
--- 1918,1922 ----
}
! Coord pos = getArgCoord( 0 );
if ( pos.map != self->pChar->pos().map )
***************
*** 2013,2017 ****
}
! Coord_cl targetPos;
if (checkWpCoord(target)) {
--- 2013,2017 ----
}
! Coord targetPos;
if (checkWpCoord(target)) {
***************
*** 2049,2053 ****
} else if (target->ob_type == &wpTargetType) {
SERIAL object = ((wpTarget*)target)->object;
! Coord_cl pos = ((wpTarget*)target)->pos;
unsigned short model = ((wpTarget*)target)->model;
--- 2049,2053 ----
} else if (target->ob_type == &wpTargetType) {
SERIAL object = ((wpTarget*)target)->object;
! Coord pos = ((wpTarget*)target)->pos;
unsigned short model = ((wpTarget*)target)->model;
***************
*** 2092,2096 ****
// Now that we have the target position, measure the distance.
! Coord_cl pos = self->pChar->pos().losCharPoint(true);
if (pos.map != targetPos.map) {
--- 2092,2096 ----
// Now that we have the target position, measure the distance.
! Coord pos = self->pChar->pos().losCharPoint(true);
if (pos.map != targetPos.map) {
Index: pyregion.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/pyregion.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** pyregion.cpp 22 Aug 2004 02:29:52 -0000 1.22
--- pyregion.cpp 3 Nov 2004 02:09:33 -0000 1.23
***************
*** 41,45 ****
cTerritory* pRegion;
bool frozen; // unused yet
! Coord_cl pos; // unused yet
} wpRegion;
--- 41,45 ----
cTerritory* pRegion;
bool frozen; // unused yet
! Coord pos; // unused yet
} wpRegion;
Index: engine.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/engine.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** engine.cpp 9 Oct 2004 14:32:22 -0000 1.36
--- engine.cpp 3 Nov 2004 02:09:32 -0000 1.37
***************
*** 57,61 ****
};
! typedef SingletonHolder<cCleanupHandlers> CleanupHandlers;
void registerCleanupHandler( fnCleanupHandler handler )
--- 57,61 ----
};
! typedef Singleton<cCleanupHandlers> CleanupHandlers;
void registerCleanupHandler( fnCleanupHandler handler )
|