Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv7086
Modified Files:
combat.cpp customtags.cpp customtags.h dbl_single_click.cpp
dragdrop.cpp items.cpp items.h player.cpp uobject.cpp
wolfpack.cpp wolfpack.vcproj world.cpp wpdefmanager.cpp
wpdefmanager.h
Log Message:
Fixed an annoying cVariant memory leak.
We should consider switching to PyObject soon.
Index: combat.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/combat.cpp,v
retrieving revision 1.156
retrieving revision 1.157
diff -C2 -d -r1.156 -r1.157
*** combat.cpp 23 Sep 2003 11:53:31 -0000 1.156
--- combat.cpp 26 Nov 2003 03:53:52 -0000 1.157
***************
*** 467,470 ****
--- 467,472 ----
// If we used a poisoned Weapon to deal
// damage, apply the poison here
+ /*
+ We currently do not support poisoned weapons
if( pWeapon && ( pWeapon->poisoned() > 0 ) )
{
***************
*** 474,478 ****
pDefender->setPoisonTime( uiCurrentTime + ( MY_CLOCKS_PER_SEC * ( 40 / pDefender->poisoned() ) ) );
pDefender->setPoisonWearOffTime( pDefender->poisonTime() + ( MY_CLOCKS_PER_SEC * SrvParams->poisonTimer() ) );
! }
// If we item we used was enchantet using
--- 476,480 ----
pDefender->setPoisonTime( uiCurrentTime + ( MY_CLOCKS_PER_SEC * ( 40 / pDefender->poisoned() ) ) );
pDefender->setPoisonWearOffTime( pDefender->poisonTime() + ( MY_CLOCKS_PER_SEC * SrvParams->poisonTimer() ) );
! }*/
// If we item we used was enchantet using
Index: customtags.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/customtags.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** customtags.cpp 23 Sep 2003 23:55:19 -0000 1.33
--- customtags.cpp 26 Nov 2003 03:53:52 -0000 1.34
***************
*** 43,137 ****
#include <qshared.h>
! cVariant::Private::Private()
{
! typ = cVariant::Invalid;
}
! cVariant::Private::Private( Private* d )
! {
!
! switch( d->typ )
! {
! case cVariant::Invalid:
! break;
! case cVariant::String:
! value.ptr = new QString( *((QString*)d->value.ptr) );
! break;
! case cVariant::Int:
! value.i = d->value.i;
! break;
! case cVariant::Double:
! value.d = d->value.d;
! break;
! case cVariant::BaseChar:
! value.ptr = d->value.ptr;
! case cVariant::Item:
! value.ptr = d->value.ptr;
! case cVariant::Coord:
! value.ptr = d->value.ptr;
! default:
! Q_ASSERT( 0 );
! }
!
! typ = d->typ;
! }
! cVariant::Private::~Private()
{
! clear();
}
! void cVariant::Private::clear()
{
switch( typ )
{
case cVariant::String:
! delete (QString*)value.ptr;
break;
- case cVariant::Invalid:
- case cVariant::Int:
- case cVariant::Double:
- case cVariant::BaseChar:
- case cVariant::Item:
- break;
case cVariant::Coord:
! delete (Coord_cl*)value.ptr;
break;
}
! typ = cVariant::Invalid;
}
! /*!
! Constructs an invalid variant.
! */
! cVariant::cVariant()
{
! d = new Private;
! }
! /*!
! Destroys the cVariant and the contained object.
! Note that subclasses that reimplement clear() should reimplement
! the destructor to call clear(). This destructor calls clear(), but
! because it is the destructor, cVariant::clear() is called rather than
! a subclass's clear().
! */
! cVariant::~cVariant()
{
! if ( d->deref() )
! delete d;
}
! /*!
! Constructs a copy of the variant, \a p, passed as the argument to this
! constructor. Usually this is a deep copy, but a shallow copy is made
! if the stored data type is explicitly shared, as e.g. QImage is.
! */
! cVariant::cVariant( const cVariant& p )
{
! d = new Private;
! *this = p;
}
--- 43,122 ----
#include <qshared.h>
! /*!
! Constructs an invalid variant.
! */
! cVariant::cVariant()
{
! typ = cVariant::Invalid;
}
! /*!
! Destroys the cVariant and the contained object.
! Note that subclasses that reimplement clear() should reimplement
! the destructor to call clear(). This destructor calls clear(), but
! because it is the destructor, cVariant::clear() is called rather than
! a subclass's clear().
! */
! cVariant::~cVariant()
{
! clear();
}
! cVariant& cVariant::operator= ( const cVariant &v )
{
+ typ = v.typ;
+
+ // For non pointer types we can simply use the union
switch( typ )
{
case cVariant::String:
! value.ptr = new QString( v.toString() );
break;
case cVariant::Coord:
! value.ptr = new Coord_cl( v.toCoord() );
break;
+ default:
+ memcpy( &value, &v.value, sizeof( value ) );
+ break;
}
! return *this;
}
! bool cVariant::operator==( const cVariant &v ) const
{
! if( typ == v.typ )
! {
! switch( typ )
! {
! case cVariant::String:
! return *(QString*)value.ptr == *(QString*)v.value.ptr;
!
! case cVariant::Coord:
! return *(Coord_cl*)value.ptr == *(Coord_cl*)v.value.ptr;
! case Int:
! return value.i == v.value.i;
! case Double:
! return value.d == v.value.d;
!
! default:
! return true;
! }
! }
!
! return false;
! }
!
! bool cVariant::operator!=( const cVariant &v ) const
{
! return !operator==( v );
}
! cVariant::cVariant( const cVariant &v )
{
! *this = v;
}
***************
*** 141,147 ****
cVariant::cVariant( const QString& val )
{
! d = new Private;
! d->typ = String;
! d->value.ptr = new QString( val );
}
--- 126,131 ----
cVariant::cVariant( const QString& val )
{
! typ = String;
! value.ptr = new QString( val );
}
***************
*** 151,157 ****
cVariant::cVariant( int val )
{
! d = new Private;
! d->typ = Int;
! d->value.i = val;
}
--- 135,140 ----
cVariant::cVariant( int val )
{
! typ = Int;
! value.i = val;
}
***************
*** 161,174 ****
cVariant::cVariant( double val )
{
! d = new Private;
! d->typ = Double;
! d->value.d = val;
}
cVariant::cVariant( long int val )
{
! d = new Private;
! d->typ = Long;
! d->value.d = val;
}
--- 144,155 ----
cVariant::cVariant( double val )
{
! typ = Double;
! value.d = val;
}
cVariant::cVariant( long int val )
{
! typ = Long;
! value.d = val;
}
***************
*** 178,184 ****
cVariant::cVariant( cBaseChar *val )
{
! d = new Private;
! d->typ = BaseChar;
! d->value.ptr = val;
}
--- 159,164 ----
cVariant::cVariant( cBaseChar *val )
{
! typ = BaseChar;
! value.ptr = val;
}
***************
*** 188,194 ****
cVariant::cVariant( cItem *val )
{
! d = new Private;
! d->typ = Item;
! d->value.ptr = val;
}
--- 168,173 ----
cVariant::cVariant( cItem *val )
{
! typ = Item;
! value.ptr = val;
}
***************
*** 198,236 ****
cVariant::cVariant( Coord_cl val )
{
! d = new Private;
! d->typ = Coord;
! d->value.ptr = new Coord_cl( val );
! }
!
! /*!
! Assigns the value of the variant \a variant to this variant.
!
! This is a deep copy of the variant, but note that if the variant
! holds an explicitly shared type such as QImage, a shallow copy
! is performed.
! */
! cVariant& cVariant::operator= ( const cVariant& variant )
! {
! cVariant& other = (cVariant&)variant;
!
! other.d->ref();
! if ( d->deref() )
! delete d;
!
! d = other.d;
!
! return *this;
! }
!
! /*!
! \internal
! */
! void cVariant::detach()
! {
! if ( d->count == 1 )
! return;
!
! d->deref();
! d = new Private( d );
}
--- 177,182 ----
cVariant::cVariant( Coord_cl val )
{
! typ = Coord;
! value.ptr = new Coord_cl( val );
}
***************
*** 243,247 ****
const char* cVariant::typeName() const
{
! return typeToName( d->typ );
}
--- 189,193 ----
const char* cVariant::typeName() const
{
! return typeToName( typ );
}
***************
*** 251,262 ****
void cVariant::clear()
{
! if ( d->count > 1 )
! {
! d->deref();
! d = new Private;
! return;
! }
! d->clear();
}
--- 197,211 ----
void cVariant::clear()
{
! switch( typ )
! {
! case cVariant::String:
! delete (QString*)value.ptr;
! break;
! case cVariant::Coord:
! delete (Coord_cl*)value.ptr;
! break;
! }
! typ = cVariant::Invalid;
}
***************
*** 323,338 ****
const QString cVariant::toString() const
{
! if ( d->typ == Int )
! return QString::number( d->value.i );
! if ( d->typ == Long )
! return QString::number( d->value.d );
! if ( d->typ == Double )
return QString::number( toDouble() );
! if ( d->typ == BaseChar )
{
! P_CHAR pChar = static_cast< P_CHAR >( d->value.ptr );
if( pChar )
return "0x" + QString::number( (unsigned int)pChar->serial(), 16 );
--- 272,287 ----
const QString cVariant::toString() const
{
! if ( typ == Int )
! return QString::number( value.i );
! if ( typ == Long )
! return QString::number( value.d );
! if ( typ == Double )
return QString::number( toDouble() );
! if ( typ == BaseChar )
{
! P_CHAR pChar = static_cast< P_CHAR >( value.ptr );
if( pChar )
return "0x" + QString::number( (unsigned int)pChar->serial(), 16 );
***************
*** 341,347 ****
}
! if ( d->typ == Item )
{
! P_ITEM pItem = static_cast< P_ITEM >( d->value.ptr );
if( pItem )
return "0x" + QString::number( (unsigned int)pItem->serial(), 16 );
--- 290,296 ----
}
! if ( typ == Item )
{
! P_ITEM pItem = static_cast< P_ITEM >( value.ptr );
if( pItem )
return "0x" + QString::number( (unsigned int)pItem->serial(), 16 );
***************
*** 350,362 ****
}
! if ( d->typ == Coord )
{
! Coord_cl *pos = static_cast< Coord_cl* >( d->value.ptr );
return QString( "%1,%2,%3,%4" ).arg( pos->x ).arg( pos->y ).arg( pos->z ).arg( pos->map );
}
! if ( d->typ != String )
return QString::null;
! return *((QString*)d->value.ptr);
}
--- 299,311 ----
}
! if ( typ == Coord )
{
! Coord_cl *pos = static_cast< Coord_cl* >( value.ptr );
return QString( "%1,%2,%3,%4" ).arg( pos->x ).arg( pos->y ).arg( pos->z ).arg( pos->map );
}
! if ( typ != String )
return QString::null;
! return *((QString*)value.ptr);
}
***************
*** 372,399 ****
int cVariant::toInt( bool * ok ) const
{
! if( d->typ == String )
! return hex2dec( *( (QString*)d->value.ptr ) ).toInt( ok );
if ( ok )
*ok = canCast( Int );
! if( d->typ == Int )
! return d->value.i;
! if( d->typ == Long )
! return d->value.d;
! if ( d->typ == Double )
! return (int)d->value.d;
! if ( d->typ == BaseChar )
{
! P_CHAR pChar = static_cast< P_CHAR >( d->value.ptr );
return pChar ? pChar->serial() : INVALID_SERIAL;
}
! if ( d->typ == Item )
{
! P_ITEM pItem = static_cast< P_ITEM >( d->value.ptr );
return pItem ? pItem->serial() : INVALID_SERIAL;
}
--- 321,348 ----
int cVariant::toInt( bool * ok ) const
{
! if( typ == String )
! return hex2dec( *( (QString*)value.ptr ) ).toInt( ok );
if ( ok )
*ok = canCast( Int );
! if( typ == Int )
! return value.i;
! if( typ == Long )
! return value.d;
! if ( typ == Double )
! return (int)value.d;
! if ( typ == BaseChar )
{
! P_CHAR pChar = static_cast< P_CHAR >( value.ptr );
return pChar ? pChar->serial() : INVALID_SERIAL;
}
! if ( typ == Item )
{
! P_ITEM pItem = static_cast< P_ITEM >( value.ptr );
return pItem ? pItem->serial() : INVALID_SERIAL;
}
***************
*** 413,440 ****
double cVariant::toDouble( bool * ok ) const
{
! if( d->typ == String )
! return ((QString*)d->value.ptr)->toDouble( ok );
if ( ok )
*ok = canCast( Double );
! if ( d->typ == Double )
! return d->value.d;
! if ( d->typ == Int )
! return (double)d->value.i;
! if ( d->typ == Long )
! return (double)d->value.d;
! if ( d->typ == BaseChar )
{
! P_CHAR pChar = static_cast< P_CHAR >( d->value.ptr );
return pChar ? (double)pChar->serial() : (double)INVALID_SERIAL;
}
! if ( d->typ == Item )
{
! P_ITEM pItem = static_cast< P_ITEM >( d->value.ptr );
return pItem ? (double)pItem->serial() : (double)INVALID_SERIAL;
}
--- 362,389 ----
double cVariant::toDouble( bool * ok ) const
{
! if( typ == String )
! return ((QString*)value.ptr)->toDouble( ok );
if ( ok )
*ok = canCast( Double );
! if ( typ == Double )
! return value.d;
! if ( typ == Int )
! return (double)value.i;
! if ( typ == Long )
! return (double)value.d;
! if ( typ == BaseChar )
{
! P_CHAR pChar = static_cast< P_CHAR >( value.ptr );
return pChar ? (double)pChar->serial() : (double)INVALID_SERIAL;
}
! if ( typ == Item )
{
! P_ITEM pItem = static_cast< P_ITEM >( value.ptr );
return pItem ? (double)pItem->serial() : (double)INVALID_SERIAL;
}
***************
*** 451,468 ****
cBaseChar *cVariant::toChar() const
{
! if( d->typ == BaseChar )
! return (P_CHAR)d->value.ptr;
! if( d->typ == String )
! return FindCharBySerial( hex2dec( *( (QString*)d->value.ptr ) ).toUInt() );
! if( d->typ == Int )
! return FindCharBySerial( d->value.i );
! if( d->typ == Long )
! return FindCharBySerial( d->value.d );
! if( d->typ == Double )
! return FindCharBySerial( floor( d->value.d ) );
return 0;
--- 400,417 ----
cBaseChar *cVariant::toChar() const
{
! if( typ == BaseChar )
! return (P_CHAR)value.ptr;
! if( typ == String )
! return FindCharBySerial( hex2dec( *( (QString*)value.ptr ) ).toUInt() );
! if( typ == Int )
! return FindCharBySerial( value.i );
! if( typ == Long )
! return FindCharBySerial( value.d );
! if( typ == Double )
! return FindCharBySerial( floor( value.d ) );
return 0;
***************
*** 475,492 ****
cItem *cVariant::toItem() const
{
! if( d->typ == Item )
! return (P_ITEM)d->value.ptr;
! if( d->typ == String )
! return FindItemBySerial( hex2dec( *( (QString*)d->value.ptr ) ).toUInt() );
! if( d->typ == Int )
! return FindItemBySerial( d->value.i );
! if( d->typ == Long )
! return FindItemBySerial( d->value.d );
! if( d->typ == Double )
! return FindItemBySerial( floor( d->value.d ) );
return 0;
--- 424,441 ----
cItem *cVariant::toItem() const
{
! if( typ == Item )
! return (P_ITEM)value.ptr;
! if( typ == String )
! return FindItemBySerial( hex2dec( *( (QString*)value.ptr ) ).toUInt() );
! if( typ == Int )
! return FindItemBySerial( value.i );
! if( typ == Long )
! return FindItemBySerial( value.d );
! if( typ == Double )
! return FindItemBySerial( floor( value.d ) );
return 0;
***************
*** 499,510 ****
Coord_cl cVariant::toCoord() const
{
! if( d->typ == Coord )
! return *( (Coord_cl*)d->value.ptr );
// Parse Coord
! if( d->typ == String )
{
Coord_cl pos;
! if( parseCoordinates( *( (QString*)d->value.ptr ), pos ) )
return pos;
}
--- 448,459 ----
Coord_cl cVariant::toCoord() const
{
! if( typ == Coord )
! return *( (Coord_cl*)value.ptr );
// Parse Coord
! if( typ == String )
{
Coord_cl pos;
! if( parseCoordinates( *( (QString*)value.ptr ), pos ) )
return pos;
}
***************
*** 514,518 ****
#define Q_VARIANT_AS( f ) Q##f& cVariant::as##f() { \
! if ( d->typ != f ) *this = cVariant( to##f() ); else detach(); return *((Q##f*)d->value.ptr);}
Q_VARIANT_AS(String)
--- 463,467 ----
#define Q_VARIANT_AS( f ) Q##f& cVariant::as##f() { \
! if ( typ != f ) *this = cVariant( to##f() ); return *((Q##f*)value.ptr);}
Q_VARIANT_AS(String)
***************
*** 533,544 ****
int& cVariant::asInt()
{
! detach();
! if ( d->typ != Int ) {
int i = toInt();
! d->clear();
! d->value.i = i;
! d->typ = Int;
}
! return d->value.i;
}
--- 482,492 ----
int& cVariant::asInt()
{
! if ( typ != Int ) {
int i = toInt();
! clear();
! value.i = i;
! typ = Int;
}
! return value.i;
}
***************
*** 548,558 ****
double& cVariant::asDouble()
{
! if ( d->typ != Double ) {
double dbl = toDouble();
! d->clear();
! d->value.d = dbl;
! d->typ = Double;
}
! return d->value.d;
}
--- 496,506 ----
double& cVariant::asDouble()
{
! if ( typ != Double ) {
double dbl = toDouble();
! clear();
! value.d = dbl;
! typ = Double;
}
! return value.d;
}
***************
*** 571,587 ****
bool cVariant::canCast( Type t ) const
{
! if ( d->typ == t )
return TRUE;
! if ( t == Int && ( d->typ == Int || d->typ == Long || d->typ == BaseChar || d->typ == Item || d->typ == String || d->typ == Double ) )
return TRUE;
! if ( t == Double && ( d->typ == BaseChar || d->typ == Item || d->typ == Long || d->typ == String || d->typ == Int ) )
return TRUE;
! if ( t == String && ( d->typ == BaseChar || d->typ == Item || d->typ == Long || d->typ == Int || d->typ == Double ) )
return TRUE;
! if ( t == BaseChar && ( d->typ == BaseChar || d->typ == Int || d->typ == Double || d->typ == String || d->typ == Long ) )
return TRUE;
! if ( t == Item && ( d->typ == Item || d->typ == Int || d->typ == Double || d->typ == String || d->typ == Long ) )
return TRUE;
! if ( t == Coord && ( d->typ == String || d->typ == Coord ) )
return TRUE;
--- 519,535 ----
bool cVariant::canCast( Type t ) const
{
! if ( typ == t )
return TRUE;
! if ( t == Int && ( typ == Int || typ == Long || typ == BaseChar || typ == Item || typ == String || typ == Double ) )
return TRUE;
! if ( t == Double && ( typ == BaseChar || typ == Item || typ == Long || typ == String || typ == Int ) )
return TRUE;
! if ( t == String && ( typ == BaseChar || typ == Item || typ == Long || typ == Int || typ == Double ) )
return TRUE;
! if ( t == BaseChar && ( typ == BaseChar || typ == Int || typ == Double || typ == String || typ == Long ) )
return TRUE;
! if ( t == Item && ( typ == Item || typ == Int || typ == Double || typ == String || typ == Long ) )
return TRUE;
! if ( t == Coord && ( typ == String || typ == Coord ) )
return TRUE;
***************
*** 619,654 ****
}
- /*! Compares this cVariant with \a v and returns TRUE if they are
- equal; otherwise returns FALSE.
- */
-
- bool cVariant::operator==( const cVariant &v ) const
- {
- if ( !v.canCast( type() ) )
- return FALSE;
- switch( d->typ ) {
- case String:
- return v.toString() == toString();
- case Int:
- return v.toInt() == toInt();
- case Double:
- return v.toDouble() == toDouble();
- case Invalid:
- break;
- }
- return FALSE;
- }
-
- /*! Compares this cVariant with \a v and returns TRUE if they are
- not equal; otherwise returns FALSE.
- */
-
- bool cVariant::operator!=( const cVariant &v ) const
- {
- return !( v == *this );
- }
-
-
-
/*****************************************************************************
cCustomTags member functions
--- 567,570 ----
***************
*** 781,785 ****
changed = true;
}
! else if( iter.data() != value )
{
iter.data() = value;
--- 697,701 ----
changed = true;
}
! else
{
iter.data() = value;
***************
*** 840,842 ****
}
! cVariant cVariant::null;
--- 756,758 ----
}
! const cVariant cVariant::null;
Index: customtags.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/customtags.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** customtags.h 23 Sep 2003 23:55:20 -0000 1.21
--- customtags.h 26 Nov 2003 03:53:52 -0000 1.22
***************
*** 53,57 ****
{
public:
! static cVariant null;
enum Type
--- 53,58 ----
{
public:
! // Static NULL instance
! static const cVariant null;
enum Type
***************
*** 70,74 ****
~cVariant();
! cVariant( const cVariant& p );
cVariant( const QString& );
cVariant( int );
--- 71,75 ----
~cVariant();
! cVariant( const cVariant &v );
cVariant( const QString& );
cVariant( int );
***************
*** 79,86 ****
cVariant( long int );
- cVariant& operator= ( const cVariant& );
- bool operator==( const cVariant& ) const;
- bool operator!=( const cVariant& ) const;
-
Type type() const;
const char* typeName() const;
--- 80,83 ----
***************
*** 100,103 ****
--- 97,104 ----
Coord_cl toCoord() const;
+ cVariant& operator= ( const cVariant& );
+ bool operator==( const cVariant& ) const;
+ bool operator!=( const cVariant& ) const;
+
QString& asString();
int& asInt();
***************
*** 109,133 ****
bool isString();
private:
! void detach();
!
! class Private : public QShared
! {
! public:
! Private();
! Private( Private* );
! ~Private();
!
! void clear();
!
! Type typ;
! union
! {
! int i;
! double d;
! void *ptr;
! } value;
! };
!
! Private* d;
};
--- 110,120 ----
bool isString();
private:
! Type typ;
!
! union {
! int i;
! double d;
! void *ptr;
! } value;
};
***************
*** 135,144 ****
inline cVariant::Type cVariant::type() const
{
! return d->typ;
}
inline bool cVariant::isValid() const
{
! return (d->typ != Invalid);
}
--- 122,131 ----
inline cVariant::Type cVariant::type() const
{
! return typ;
}
inline bool cVariant::isValid() const
{
! return (typ != Invalid);
}
Index: dbl_single_click.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/dbl_single_click.cpp,v
retrieving revision 1.226
retrieving revision 1.227
diff -C2 -d -r1.226 -r1.227
*** dbl_single_click.cpp 23 Sep 2003 23:55:20 -0000 1.226
--- dbl_single_click.cpp 26 Nov 2003 03:53:52 -0000 1.227
***************
*** 360,373 ****
}
- if ((pi->poisoned()) &&(pc_currchar->poisoned() < pi->poisoned()))
- {
- socket->sysMessage(tr("You have been poisoned!"));
- pc_currchar->soundEffect( 0x246 ); // poison sound
- pc_currchar->setPoisoned( pi->poisoned() );
- pc_currchar->setPoisonTime( uiCurrentTime +(MY_CLOCKS_PER_SEC*(40/pc_currchar->poisoned()))); // a lev.1 poison takes effect after 40 secs, a deadly pois.(lev.4) takes 40/4 secs - AntiChrist
- pc_currchar->setPoisonWearOffTime( pc_currchar->poisonTime() +(MY_CLOCKS_PER_SEC*SrvParams->poisonTimer()) ); // wear off starts after poison takes effect - AntiChrist
- pc_currchar->resend( false );
- }
-
pi->reduceAmount( 1 ); // Remove a food item
pc_currchar->setHunger( pc_currchar->hunger() + 1 );
--- 360,363 ----
Index: dragdrop.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/dragdrop.cpp,v
retrieving revision 1.207
retrieving revision 1.208
diff -C2 -d -r1.207 -r1.208
*** dragdrop.cpp 25 Nov 2003 19:41:30 -0000 1.207
--- dragdrop.cpp 26 Nov 2003 03:53:52 -0000 1.208
***************
*** 806,825 ****
pChar->soundEffect( 0x3A + RandomNum( 1, 3 ) );
- // If you want to poison a pet... Why not
- if( pItem->poisoned() && pChar->poisoned() < pItem->poisoned() )
- {
- pChar->soundEffect( 0x246 );
- pChar->setPoisoned( pItem->poisoned() );
-
- // a lev.1 poison takes effect after 40 secs, a deadly pois.(lev.4) takes 40/4 secs - AntiChrist
- pChar->setPoisonTime( uiCurrentTime + ( MY_CLOCKS_PER_SEC * ( 40 / pChar->poisoned() ) ) );
-
- //wear off starts after poison takes effect - AntiChrist
- pChar->setPoisonWearOffTime(pChar->poisonTime() + ( MY_CLOCKS_PER_SEC * SrvParams->poisonTimer() ) );
-
- // Refresh the health-bar of our target
- pChar->resend( false );
- }
-
// *You see Snowwhite eating some poisoned apples*
// Color: 0x0026
--- 806,809 ----
***************
*** 849,869 ****
pBeggar->talk( tr("*cough* Thank thee!") );
pBeggar->soundEffect( 0x3A + RandomNum( 1, 3 ) );
-
- // If you want to poison a pet... Why not
- if( pItem->poisoned() && pBeggar->poisoned() < pItem->poisoned() )
- {
- pBeggar->soundEffect( 0x246 );
- pBeggar->setPoisoned( pItem->poisoned() );
-
- // a lev.1 poison takes effect after 40 secs, a deadly pois.(lev.4) takes 40/4 secs - AntiChrist
- pBeggar->setPoisonTime( uiCurrentTime + ( MY_CLOCKS_PER_SEC * ( 40 / pBeggar->poisoned() ) ) );
-
- //wear off starts after poison takes effect - AntiChrist
- pBeggar->setPoisonWearOffTime( pBeggar->poisonTime() + ( MY_CLOCKS_PER_SEC * SrvParams->poisonTimer() ) );
-
- // Refresh the health-bar of our target
- pBeggar->resend( false );
- }
-
// *You see Snowwhite eating some poisoned apples*
--- 833,836 ----
Index: items.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/items.cpp,v
retrieving revision 1.360
retrieving revision 1.361
diff -C2 -d -r1.360 -r1.361
*** items.cpp 24 Nov 2003 03:14:52 -0000 1.360
--- items.cpp 26 Nov 2003 03:53:52 -0000 1.361
***************
*** 110,114 ****
// constructor
cItem::cItem(): container_(0), totalweight_(0), sellprice_( 0 ),
! buyprice_( 0 ), restock_( 1 ), antispamtimer_( 0 ), base( 0 )
{
spawnregion_ = QString::null;
--- 110,114 ----
// constructor
cItem::cItem(): container_(0), totalweight_(0), sellprice_( 0 ),
! buyprice_( 0 ), restock_( 1 ), base( 0 )
{
spawnregion_ = QString::null;
***************
*** 129,133 ****
//cItem properties setting
this->amount_ = src.amount_;
- this->antispamtimer_ = src.antispamtimer();
this->buyprice_ = src.buyprice_;
this->changed( TOOLTIP );
--- 129,132 ----
***************
*** 145,149 ****
this->magic_ = src.magic_;
this->maxhp_ = src.maxhp_;
- this->poisoned_ = src.poisoned_;
this->priv_=src.priv_;
this->restock_ = src.restock_;
--- 144,147 ----
***************
*** 471,475 ****
addField("maxhp", maxhp_ );
addField("speed", speed_ );
- addField("poisoned", poisoned_ );
addField("magic", magic_ );
addField("owner", ownserial_ );
--- 469,472 ----
***************
*** 579,583 ****
this->visible_=0; // 0=Normally Visible, 1=Owner & GM Visible, 2=GM Visible
this->priv_ = 0; // Bit 0, nodecay off/on. Bit 1, newbie item off/on. Bit 2 Dispellable
- this->poisoned_ = 0; //AntiChrist -- for poisoning skill
}
--- 576,579 ----
***************
*** 1182,1186 ****
this->setCorpse( false );
! // <id>12f9</id>
else if( TagName == "id" )
{
--- 1178,1182 ----
this->setCorpse( false );
! // <id>0x12f9</id>
else if( TagName == "id" )
{
***************
*** 1671,1682 ****
void cItem::talk( const QString &message, UI16 color, UINT8 type, bool autospam, cUOSocket* socket )
{
- if( autospam )
- {
- if( antispamtimer() < uiCurrentTime )
- setAntispamtimer( uiCurrentTime + MY_CLOCKS_PER_SEC*10 );
- else
- return;
- }
-
QString lang;
--- 1667,1670 ----
***************
*** 1856,1860 ****
maxhp_ = atoi( result[offset++] );
speed_ = atoi( result[offset++] );
- poisoned_ = atoi( result[offset++] );
magic_ = atoi( result[offset++] );
ownserial_ = atoi( result[offset++] );
--- 1844,1847 ----
***************
*** 1882,1886 ****
{
cUObject::buildSqlString( fields, tables, conditions );
! fields.push_back( "items.id,items.color,items.cont,items.layer,items.type,items.type2,items.amount,items.decaytime,items.def,items.hidamage,items.lodamage,items.weight,items.hp,items.maxhp,items.speed,items.poisoned,items.magic,items.owner,items.visible,items.spawnregion,items.priv,items.sellprice,items.buyprice,items.restock,items.baseid" );
tables.push_back( "items" );
conditions.push_back( "uobjectmap.serial = items.serial" );
--- 1869,1873 ----
{
cUObject::buildSqlString( fields, tables, conditions );
! fields.push_back( "items.id,items.color,items.cont,items.layer,items.type,items.type2,items.amount,items.decaytime,items.def,items.hidamage,items.lodamage,items.weight,items.hp,items.maxhp,items.speed,items.magic,items.owner,items.visible,items.spawnregion,items.priv,items.sellprice,items.buyprice,items.restock,items.baseid" );
tables.push_back( "items" );
conditions.push_back( "uobjectmap.serial = items.serial" );
***************
*** 2055,2058 ****
--- 2042,2046 ----
changed( TOOLTIP );
flagChanged();
+
SET_INT_PROPERTY( "id", id_ )
else SET_INT_PROPERTY( "color", color_ )
***************
*** 2104,2108 ****
return 0;
}
- else SET_INT_PROPERTY( "antispamtimer", antispamtimer_ )
else if( name == "container" )
--- 2092,2095 ----
***************
*** 2165,2169 ****
else SET_INT_PROPERTY( "buyprice", buyprice_ )
else SET_INT_PROPERTY( "restock", restock_ )
- else SET_INT_PROPERTY( "poisoned", poisoned_ )
else SET_INT_PROPERTY( "magic", magic_ )
else SET_INT_PROPERTY( "visible", visible_ )
--- 2152,2155 ----
***************
*** 2252,2256 ****
else GET_PROPERTY( "owner", owner() )
else GET_PROPERTY( "totalweight", totalweight_ )
- else GET_PROPERTY( "antispamtimer", (int)antispamtimer_ )
// container
--- 2238,2241 ----
***************
*** 2278,2282 ****
else GET_PROPERTY( "sellprice", sellprice_ )
else GET_PROPERTY( "restock", restock_ )
- else GET_PROPERTY( "poisoned", (int)poisoned_ )
else GET_PROPERTY( "magic", magic_ )
--- 2263,2266 ----
Index: items.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/items.h,v
retrieving revision 1.180
retrieving revision 1.181
diff -C2 -d -r1.180 -r1.181
*** items.h 24 Nov 2003 02:36:10 -0000 1.180
--- items.h 26 Nov 2003 03:53:53 -0000 1.181
***************
*** 79,93 ****
typedef SingletonHolder< cItemBases > ItemBases;
class cItem : public cUObject
{
private:
bool changed_;
- void flagChanged() { changed_ = true; } // easier to debug, compiler should mak...
[truncated message content] |