Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv2931
Modified Files:
basechar.cpp basechar.h basechar_flatstore.cpp
dbl_single_click.cpp debug.cpp item_flatstore.cpp items.cpp
items.h npc.cpp player.cpp prototypes.h skills.cpp uobject.cpp
uobject.h wolfpack.cpp
Log Message:
- moved direction from cItem and cBaseChar to cUObject.
- Removed some dead code
- Notice that the SQL changed a bit due to the first item :)
Index: basechar.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/basechar.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** basechar.cpp 17 Jul 2003 09:14:12 -0000 1.29
--- basechar.cpp 11 Aug 2003 03:34:40 -0000 1.30
***************
*** 63,67 ****
weight_ = 0;
bodyArmor_ = 2;
- direction_ = 0;
dexterity_ = 0;
dexterityMod_ = 0;
--- 63,66 ----
***************
*** 133,137 ****
cUObject::buildSqlString( fields, tables, conditions );
fields.push_back( "characters.name,characters.title,characters.creationdate" );
! fields.push_back( "characters.dir,characters.body,characters.orgbody,characters.skin" );
fields.push_back( "characters.orgskin,characters.saycolor" );
fields.push_back( "characters.emotecolor,characters.strength,characters.strengthmod,characters.dexterity" );
--- 132,136 ----
cUObject::buildSqlString( fields, tables, conditions );
fields.push_back( "characters.name,characters.title,characters.creationdate" );
! fields.push_back( "characters.body,characters.orgbody,characters.skin" );
fields.push_back( "characters.orgskin,characters.saycolor" );
fields.push_back( "characters.emotecolor,characters.strength,characters.strengthmod,characters.dexterity" );
***************
*** 166,170 ****
title_ = result[offset++];
creationDate_ = QDateTime::fromString( result[offset++], Qt::ISODate );
- direction_ = atoi( result[offset++] );
bodyID_ = atoi( result[offset++] );
orgBodyID_ = atoi( result[offset++] );
--- 165,168 ----
***************
*** 252,256 ****
addStrField( "title", title_ );
addField( "creationdate", creationDate_.toString() );
- addField( "dir", direction_ );
addField( "body", bodyID_ );
addField( "orgbody", orgBodyID_ );
--- 250,253 ----
***************
*** 408,412 ****
action.setAction( id );
action.setSerial( serial() );
! action.setDirection( direction_ );
action.setRepeat( 1 );
action.setRepeatFlag( 0 );
--- 405,409 ----
action.setAction( id );
action.setSerial( serial() );
! action.setDirection( direction() );
action.setRepeat( 1 );
action.setRepeatFlag( 0 );
***************
*** 607,614 ****
return;
! if( nDir != direction_ )
{
changed( SAVE );
! direction_ = nDir;
update();
}
--- 604,611 ----
return;
! if( nDir != direction() )
{
changed( SAVE );
! setDirection( nDir );
update();
}
***************
*** 1238,1264 ****
}
- //<direction>SE</direction>
- else if( TagName == "direction" )
- {
- if( Value == "NE" )
- this->direction_ = 1;
- else if( Value == "E" )
- this->direction_ = 2;
- else if( Value == "SE" )
- this->direction_ = 3;
- else if( Value == "S" )
- this->direction_ = 4;
- else if( Value == "SW" )
- this->direction_ = 5;
- else if( Value == "W" )
- this->direction_ = 6;
- else if( Value == "NW" )
- this->direction_ = 7;
- else if( Value == "N" )
- this->direction_ = 0;
- else
- this->direction_ = Value.toUShort();
- }
-
//<stat type="str">100</stats>
else if( TagName == "stat" )
--- 1235,1238 ----
***************
*** 1662,1666 ****
else SET_INT_PROPERTY( "dexterity2", dexterityMod_ )
else SET_INT_PROPERTY( "intelligence2", intelligenceMod_ )
- else SET_INT_PROPERTY( "direction", direction_ )
else SET_INT_PROPERTY( "xid", orgBodyID_ )
else SET_INT_PROPERTY( "orgid", orgBodyID_ )
--- 1636,1639 ----
***************
*** 1759,1763 ****
else GET_PROPERTY( "dexterity2", dexterityMod_ )
else GET_PROPERTY( "intelligence2", intelligenceMod_ )
- else GET_PROPERTY( "direction", direction_ )
else GET_PROPERTY( "orgid", orgBodyID_ )
else GET_PROPERTY( "xid", orgBodyID_ )
--- 1732,1735 ----
Index: basechar.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/basechar.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** basechar.h 6 Jul 2003 13:48:01 -0000 1.20
--- basechar.h 11 Aug 2003 03:34:40 -0000 1.21
***************
*** 80,84 ****
// implementation of interfaces
! void load( char **, UINT16& );
void save();
void save( FlatStore::OutputFile*, bool first = false ) throw();
--- 80,84 ----
// implementation of interfaces
! void load( char **, ushort& );
void save();
[...1609 lines suppressed...]
! inline UINT32 cBaseChar::regenManaTime() const
{
return regenManaTime_;
}
! inline void cBaseChar::setRegenManaTime(UINT32 data)
{
regenManaTime_ = data;
--- 1116,1125 ----
}
! inline uint cBaseChar::regenManaTime() const
{
return regenManaTime_;
}
! inline void cBaseChar::setRegenManaTime(uint data)
{
regenManaTime_ = data;
Index: basechar_flatstore.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/basechar_flatstore.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** basechar_flatstore.cpp 25 Jun 2003 13:21:41 -0000 1.3
--- basechar_flatstore.cpp 11 Aug 2003 03:34:40 -0000 1.4
***************
*** 223,230 ****
break;
- case CHAR_DIR:
- input->readUChar( direction_ );
- break;
-
case CHAR_BODY:
input->readUShort( bodyID_ );
--- 223,226 ----
Index: dbl_single_click.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/dbl_single_click.cpp,v
retrieving revision 1.208
retrieving revision 1.209
diff -C2 -d -r1.208 -r1.209
*** dbl_single_click.cpp 20 Jul 2003 00:04:51 -0000 1.208
--- dbl_single_click.cpp 11 Aug 2003 03:34:40 -0000 1.209
***************
*** 510,578 ****
// PlayerVendors deed
! case 217:
! {
! if (pi->isLockedDown())
! {
! socket->sysMessage(tr("That item is locked down."));
! return;
! }
!
! cMulti* pi_multi = cMulti::findMulti( pc_currchar->pos() );
! if( pi_multi && pc_currchar->inRange( pi_multi, 18 ) )
! {
! if ( !IsHouse( pi_multi->id() ) )
! return;
! int los = 0;
! const P_ITEM pi_p = pc_currchar->getBackpack();
! if( pi_p )
! {
! los = 0;
! cItem::ContainerContent container = pi_p->content();
! cItem::ContainerContent::const_iterator it(container.begin());
! for( ; it != container.end(); ++it )
! {
! const P_ITEM pi_i = *it;
! if ( pi_i ) // lb
! if (pi_i->type() == 7 && calcserial(pi_i->more1(), pi_i->more2(), pi_i->more3(), pi_i->more4()) == pi_multi->serial())
! {
! los = 1;
! break;
! }
! }
! }
!
! if (los)
! {
! P_NPC pc_vendor = cCharStuff::createScriptNpc( "2117", pc_currchar->pos() );
!
! if (pc_vendor == NULL)
! {
! clConsole.send("npc-script couldnt find vendor in npc-section 2117!\n");
! return;
! }
!
! // pc_vendor->setNpcAIType( 17 );
! pc_vendor->setInvulnerable( true );
! pc_vendor->setHidden( false );
! pc_vendor->setInvisible( false );
! pc_vendor->setStealthedSteps(-1);
! pc_vendor->setDirection( pc_currchar->direction() );
! pc_vendor->setWanderType( enHalt );
! pc_vendor->setMurdererTime( 0 );
! pc_vendor->setCriminalTime( 0 );
! pc_vendor->setOwner( pc_currchar );
! pc_vendor->setTamed(false);
! Items->DeleItem(pi);
! pc_vendor->talk( tr("Hello sir! My name is %1 and i will be working for you.").arg(pc_vendor->name()), -1, 0 );
! pc_vendor->update();
! }
! else
! socket->sysMessage(tr("You must be close to a house and have a key in your pack to place that."));
! }
! else if (pi_multi == NULL)
! socket->sysMessage(tr("You must be close to a house and have a key in your pack to place that."));
!
! return;
! }
break;
--- 510,515 ----
// PlayerVendors deed
! case 217:
! qWarning("Player Vendor code is gone, sorry... implement in python");
break;
Index: debug.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/debug.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** debug.cpp 4 Aug 2003 07:28:17 -0000 1.10
--- debug.cpp 11 Aug 2003 03:34:40 -0000 1.11
***************
*** 136,147 ****
Minsk, Belarus
! Modifications from Correa
*/
! #if defined(Q_OS_WIN32) && 0
#include <qfile.h>
#include <qdatetime.h>
#include <qthread.h>
#define SystemBasicInformation 0
--- 136,148 ----
Minsk, Belarus
! Modifications by Correa
*/
! #if defined(Q_OS_WIN32) && 1
#include <qfile.h>
#include <qdatetime.h>
#include <qthread.h>
+ #include <windows.h>
#define SystemBasicInformation 0
***************
*** 558,561 ****
--- 559,563 ----
.arg(hInfo->GetCPUInfo())
.arg(hInfo->HeapCommitedBytes()/1024);
+ hInfo->m_log.device()->flush();
msleep(1000);
};
***************
*** 571,575 ****
// hInfo->HeapCompareDumpWithFile(FALSE); // basic report
! hInfo->HeapCompareDumpWithFile(TRUE); // extended report
delete hInfo;
--- 573,577 ----
// hInfo->HeapCompareDumpWithFile(FALSE); // basic report
! // hInfo->HeapCompareDumpWithFile(TRUE); // extended report
delete hInfo;
***************
*** 577,581 ****
};
! //static debugThread myDebugThread;
--- 579,583 ----
};
! static debugThread myDebugThread;
Index: item_flatstore.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/item_flatstore.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** item_flatstore.cpp 20 Jul 2003 00:04:51 -0000 1.14
--- item_flatstore.cpp 11 Aug 2003 03:34:40 -0000 1.15
***************
*** 450,457 ****
break;
- case ITEM_DIRECTION:
- input->readUChar( dir_ );
- break;
-
case ITEM_PRIV:
input->readUChar( priv_ );
--- 450,453 ----
Index: items.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/items.cpp,v
retrieving revision 1.325
retrieving revision 1.326
diff -C2 -d -r1.325 -r1.326
*** items.cpp 26 Jul 2003 01:10:54 -0000 1.325
--- items.cpp 11 Aug 2003 03:34:40 -0000 1.326
***************
*** 129,133 ****
this->visible_=src.visible_;
this->spawnserial=src.spawnserial;
- this->dir_=src.dir_;
this->priv_=src.priv_;
this->buyprice_ = src.buyprice_;
--- 129,132 ----
***************
*** 513,517 ****
addField("visible", visible_);
addField("spawn", spawnserial);
- addField("dir", dir_);
addField("priv", priv_);
addField("sellprice", sellprice_);
--- 512,515 ----
***************
*** 664,668 ****
this->visible_=0; // 0=Normally Visible, 1=Owner & GM Visible, 2=GM Visible
this->spawnserial=-1;
- this->dir_=0; // Direction, or light source type.
// Everything decays by default.
this->priv_=1; // Bit 0, decay off/on. Bit 1, newbie item off/on. Bit 2 Dispellable
--- 662,665 ----
***************
*** 1861,1865 ****
sendItem->setColor( color() );
sendItem->setCoord( pos() );
! sendItem->setDirection( dir_ );
if( mSock )
--- 1858,1862 ----
sendItem->setColor( color() );
sendItem->setCoord( pos() );
! sendItem->setDirection( direction() );
if( mSock )
***************
*** 2296,2300 ****
visible_ = atoi( result[offset++] );
spawnserial = atoi( result[offset++] );
- dir_ = atoi( result[offset++] );
priv_ = atoi( result[offset++] );
sellprice_ = atoi( result[offset++] );
--- 2293,2296 ----
***************
*** 2317,2321 ****
{
cUObject::buildSqlString( fields, tables, conditions );
! fields.push_back( "items.id,items.name,items.name2,items.creator,items.sk_name,items.color,items.cont,items.layer,items.type,items.type2,items.offspell,items.more1,items.more2,items.more3,items.more4,items.morex,items.morey,items.morez,items.amount,items.doordir,items.dye,items.decaytime,items.att,items.def,items.hidamage,items.lodamage,items.st,items.time_unused,items.weight,items.hp,items.maxhp,items.rank,items.st2,items.dx,items.dx2,items.intelligence,items.intelligence2,items.speed,items.poisoned,items.magic,items.owner,items.visible,items.spawn,items.dir,items.priv,items.sellprice,items.buyprice,items.restock,items.disabled,items.spawnregion,items.good,items.description,items.accuracy" ); // for now! later on we should specify each field
tables.push_back( "items" );
conditions.push_back( "uobjectmap.serial = items.serial" );
--- 2313,2317 ----
{
cUObject::buildSqlString( fields, tables, conditions );
! fields.push_back( "items.id,items.name,items.name2,items.creator,items.sk_name,items.color,items.cont,items.layer,items.type,items.type2,items.offspell,items.more1,items.more2,items.more3,items.more4,items.morex,items.morey,items.morez,items.amount,items.doordir,items.dye,items.decaytime,items.att,items.def,items.hidamage,items.lodamage,items.st,items.time_unused,items.weight,items.hp,items.maxhp,items.rank,items.st2,items.dx,items.dx2,items.intelligence,items.intelligence2,items.speed,items.poisoned,items.magic,items.owner,items.visible,items.spawn,items.priv,items.sellprice,items.buyprice,items.restock,items.disabled,items.spawnregion,items.good,items.description,items.accuracy" ); // for now! later on we should specify each field
tables.push_back( "items" );
conditions.push_back( "uobjectmap.serial = items.serial" );
***************
*** 2650,2654 ****
else SET_INT_PROPERTY( "spawn", spawnserial )
- else SET_INT_PROPERTY( "direction", dir_ )
else SET_INT_PROPERTY( "sellprice", sellprice_ )
else SET_INT_PROPERTY( "buyprice", buyprice_ )
--- 2646,2649 ----
***************
*** 2794,2798 ****
else GET_PROPERTY( "spawn", FindItemBySerial( spawnserial ) )
- else GET_PROPERTY( "direction", dir_ )
else GET_PROPERTY( "buyprice", buyprice_ )
else GET_PROPERTY( "sellprice", sellprice_ )
--- 2789,2792 ----
Index: items.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/items.h,v
retrieving revision 1.162
retrieving revision 1.163
diff -C2 -d -r1.162 -r1.163
*** items.h 21 Jul 2003 00:08:04 -0000 1.162
--- items.h 11 Aug 2003 03:34:40 -0000 1.163
***************
*** 84,88 ****
Q_PROPERTY ( uint poisoned READ poisoned WRITE setPoisoned )
Q_PROPERTY ( int rank READ rank WRITE setRank )
- Q_PROPERTY ( uchar direction READ direction WRITE setDirection )
Q_PROPERTY ( QString description READ description WRITE setDescription )
Q_PROPERTY ( QString creator READ creator WRITE setCreator )
--- 84,87 ----
***************
*** 169,173 ****
uint poisoned() const { return poisoned_; }
int rank() const { return rank_; }
- uchar direction() const { return dir_; }
QString description() const { return desc_; }
QString creator() const { return creator_;}
--- 168,171 ----
***************
*** 228,232 ****
void setAntispamtimer ( uint data ) { antispamtimer_ = data; changed( SAVE );}
void setAccuracy( ushort data ) { accuracy_ = data; changed( SAVE );}
- void setDirection( uchar d ) { dir_ = d; changed( SAVE );}
void setDescription( const QString& d ) { desc_ = d; changed( SAVE+TOOLTIP );}
void setCreator( const QString& d ) { creator_ = d; changed( SAVE+TOOLTIP );}
--- 226,229 ----
***************
*** 439,443 ****
// RANK 10 --> 10*10=100% this item has no malus! RANK 10 is automatically setted if you select RANKSYSTEM 0.
// Vars: LODAMAGE,HIDAMAGE,ATT,DEF,HP,MAXHP
- uchar dir_;
QString desc_;
QString creator_; // Store the name of the player made this item
--- 436,439 ----
Index: npc.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/npc.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** npc.cpp 9 Jul 2003 20:23:16 -0000 1.27
--- npc.cpp 11 Aug 2003 03:34:40 -0000 1.28
***************
*** 522,526 ****
corpse->setBodyId( orgBodyID_ );
! corpse->setMoreY( ishuman( this ) ); //is human??
corpse->setCarve( carve() ); //store carve section
corpse->setName2( name() );
--- 522,526 ----
corpse->setBodyId( orgBodyID_ );
! corpse->setMoreY( this->isHuman() ); //is human??
corpse->setCarve( carve() ); //store carve section
corpse->setName2( name() );
***************
*** 529,533 ****
corpse->setMore1(nType);
! corpse->setDirection( direction_ );
corpse->startDecay();
--- 529,533 ----
corpse->setMore1(nType);
! corpse->setDirection( direction() );
corpse->startDecay();
Index: player.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/player.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** player.cpp 9 Aug 2003 03:18:52 -0000 1.21
--- player.cpp 11 Aug 2003 03:34:40 -0000 1.22
***************
*** 541,545 ****
corpse->setBodyId( orgBodyID_ );
! corpse->setMoreY( ishuman( this ) ); //is human??
corpse->setName2( name() );
--- 541,545 ----
corpse->setBodyId( orgBodyID_ );
! corpse->setMoreY( this->isHuman() ); //is human??
corpse->setName2( name() );
***************
*** 547,551 ****
corpse->setMore1(nType);
! corpse->setDirection( direction_ );
corpse->startDecay();
--- 547,551 ----
corpse->setMore1(nType);
! corpse->setDirection( direction() );
corpse->startDecay();
***************
*** 690,694 ****
pMount->setWanderRadius( pi->pos().z );
pMount->setBodyID( pi->morey() );
! pMount->setDirection( direction_ );
pMount->setStrength( pi->tags().get("strength").toInt() );
pMount->setDexterity( pi->tags().get("dexterity").toInt() );
--- 690,694 ----
pMount->setWanderRadius( pi->pos().z );
pMount->setBodyID( pi->morey() );
! pMount->setDirection( direction() );
pMount->setStrength( pi->tags().get("strength").toInt() );
pMount->setDexterity( pi->tags().get("dexterity").toInt() );
Index: prototypes.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/prototypes.h,v
retrieving revision 1.99
retrieving revision 1.100
diff -C2 -d -r1.99 -r1.100
*** prototypes.h 1 Jun 2003 14:53:56 -0000 1.99
--- prototypes.h 11 Aug 2003 03:34:40 -0000 1.100
***************
*** 44,48 ****
// Function Declarations
//
- void endScrn() ;
QString hex2dec( const QString& value );
--- 44,47 ----
***************
*** 53,58 ****
void Fame(P_CHAR pc_toChange, int nFame);
- bool ishuman(P_CHAR pc);
- int chardir(P_CHAR a, P_CHAR b);
int fielddir(P_CHAR pc, int x, int y, int z);
--- 52,55 ----
***************
*** 67,72 ****
void sellaction(int s);
void addgold(cUOSocket* s, int totgold);
- int calcValue(P_ITEM pi, int value);
- int calcGoodValue(P_CHAR npcnum, P_ITEM pi, int value,int goodtype); // by Magius(CHE) for trade system
void StoreItemRandomValue(P_ITEM pi,QString tmpreg); // by Magius(CHE) (2) for trade system
--- 64,67 ----
***************
*** 81,86 ****
void bgsound(P_CHAR pc);
int hexnumber(int countx);
- int makenumber(int countx);
- inline int calcserial(unsigned char a1,unsigned char a2,unsigned char a3,unsigned char a4) {return (static_cast<int>((a1<<24))|static_cast<int>((a2<<16)) | static_cast<int>((a3<<8)) | static_cast<int>(a4));}
int lineOfSight( const Coord_cl&, const Coord_cl&, int checkfor );
void reloadScripts();
--- 76,79 ----
Index: skills.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/skills.cpp,v
retrieving revision 1.199
retrieving revision 1.200
diff -C2 -d -r1.199 -r1.200
*** skills.cpp 6 Jul 2003 13:48:02 -0000 1.199
--- skills.cpp 11 Aug 2003 03:34:40 -0000 1.200
***************
*** 891,895 ****
int ar = 0;
! if (ishuman(pc))
{
--- 891,895 ----
int ar = 0;
! if ( pc->isHuman() )
{
Index: uobject.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/uobject.cpp,v
retrieving revision 1.101
retrieving revision 1.102
diff -C2 -d -r1.101 -r1.102
*** uobject.cpp 21 Jul 2003 00:08:04 -0000 1.101
--- uobject.cpp 11 Aug 2003 03:34:40 -0000 1.102
***************
*** 115,118 ****
--- 115,119 ----
serial_ = atoi(result[offset++]);
multis_ = atoi(result[offset++]);
+ dir_ = atoi( result[offset++] );
pos_.x = atoi(result[offset++]);
pos_.y = atoi(result[offset++]);
***************
*** 163,166 ****
--- 164,168 ----
addField( "serial", serial_ );
addField( "multis", multis_ );
+ addField( "direction", dir_);
addField( "pos_x", pos_.x );
addField( "pos_y", pos_.y );
***************
*** 208,212 ****
void cUObject::buildSqlString( QStringList &fields, QStringList &tables, QStringList &conditions )
{
! fields.push_back( "uobject.name,uobject.serial,uobject.multis,uobject.pos_x,uobject.pos_y,uobject.pos_z,uobject.pos_map,uobject.events,uobject.bindmenu,uobject.havetags" );
tables.push_back( "uobject" );
conditions.push_back( "uobjectmap.serial = uobject.serial" );
--- 210,214 ----
void cUObject::buildSqlString( QStringList &fields, QStringList &tables, QStringList &conditions )
{
! fields.push_back( "uobject.name,uobject.serial,uobject.multis,uobject.direction,uobject.pos_x,uobject.pos_y,uobject.pos_z,uobject.pos_map,uobject.events,uobject.bindmenu,uobject.havetags" );
tables.push_back( "uobject" );
conditions.push_back( "uobjectmap.serial = uobject.serial" );
***************
*** 490,498 ****
QString Value = Tag->getValue();
// <tag type="string"> also type="value"
// <key>multisection</key>
// <value>smallboat</value>
// </tag>
! if( TagName == "tag" )
{
QString tkey, tvalue;
--- 492,523 ----
QString Value = Tag->getValue();
+ //<direction>SE</direction>
+ if( TagName == "direction" )
+ {
+ if( Value == "NE" )
+ this->dir_ = 1;
+ else if( Value == "E" )
+ this->dir_ = 2;
+ else if( Value == "SE" )
+ this->dir_ = 3;
+ else if( Value == "S" )
+ this->dir_ = 4;
+ else if( Value == "SW" )
+ this->dir_ = 5;
+ else if( Value == "W" )
+ this->dir_ = 6;
+ else if( Value == "NW" )
+ this->dir_ = 7;
+ else if( Value == "N" )
+ this->dir_ = 0;
+ else
+ this->dir_ = Value.toUShort();
+ }
+
// <tag type="string"> also type="value"
// <key>multisection</key>
// <value>smallboat</value>
// </tag>
! else if( TagName == "tag" )
{
QString tkey, tvalue;
***************
*** 661,664 ****
--- 686,690 ----
else SET_INT_PROPERTY( "serial", serial_ )
else SET_INT_PROPERTY( "multi", multis_ )
+ else SET_INT_PROPERTY( "direction", dir_ )
else SET_BOOL_PROPERTY( "free", free )
else SET_STR_PROPERTY( "name", this->name_ )
***************
*** 700,704 ****
else GET_PROPERTY( "name", this->name() )
else GET_PROPERTY( "pos", pos() )
! else GET_PROPERTY( "eventlist", eventList_ == QString::null ? QString( "" ) : eventList_ );
PROPERTY_ERROR( -1, QString( "Property not found: '%1'" ).arg( name ) )
--- 726,731 ----
else GET_PROPERTY( "name", this->name() )
else GET_PROPERTY( "pos", pos() )
! else GET_PROPERTY( "eventlist", eventList_ == QString::null ? QString( "" ) : eventList_ )
! else GET_PROPERTY( "direction", dir_ )
PROPERTY_ERROR( -1, QString( "Property not found: '%1'" ).arg( name ) )
***************
*** 729,731 ****
--- 756,780 ----
if( state & SAVE ) changed_ = true;
if( state & TOOLTIP ) tooltip_ = 0xFFFFFFFF;
+ }
+
+ /*!
+ Returns the direction from this object to another \s d object
+ */
+ char cUObject::direction( cUObject* d ) const
+ {
+ int dir = -1;
+ int xdif = d->pos().x - this->pos().x;
+ int ydif = d->pos().y - this->pos().y;
+
+ if ((xdif==0)&&(ydif<0)) dir=0;
+ else if ((xdif>0)&&(ydif<0)) dir=1;
+ else if ((xdif>0)&&(ydif==0)) dir=2;
+ else if ((xdif>0)&&(ydif>0)) dir=3;
+ else if ((xdif==0)&&(ydif>0)) dir=4;
+ else if ((xdif<0)&&(ydif>0)) dir=5;
+ else if ((xdif<0)&&(ydif==0)) dir=6;
+ else if ((xdif<0)&&(ydif<0)) dir=7;
+ else dir=-1;
+
+ return dir;
}
Index: uobject.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/uobject.h,v
retrieving revision 1.66
retrieving revision 1.67
diff -C2 -d -r1.66 -r1.67
*** uobject.h 21 Jul 2003 00:08:04 -0000 1.66
--- uobject.h 11 Aug 2003 03:34:40 -0000 1.67
***************
*** 63,109 ****
};
- #define PROPERTY_ERROR( errno, data ) { stError *errRet = new stError; errRet->code = errno; errRet->text = data; return errRet; }
-
- #define GET_PROPERTY( id, getter ) if( name == id ) {\
- value = cVariant( getter ); \
- return 0; \
- }
-
- #define SET_STR_PROPERTY( id, setter ) if( name == id ) {\
- QString text = value.toString(); \
- if( text == QString::null ) \
- PROPERTY_ERROR( -2, "String expected" ) \
- setter = text; \
- return 0; \
- }
-
- #define SET_INT_PROPERTY( id, setter ) if( name == id ) {\
- bool ok; \
- INT32 data = value.toInt( &ok ); \
- if( !ok ) \
- PROPERTY_ERROR( -2, "Integer expected" ) \
- setter = data; \
- return 0; \
- }
-
- #define SET_BOOL_PROPERTY( id, setter ) if( name == id ) {\
- bool ok; \
- INT32 data = value.toInt( &ok ); \
- if( !ok ) \
- PROPERTY_ERROR( -2, "Boolean expected" ) \
- setter = data == 0 ? false : true; \
- return 0; \
- }
-
- #define SET_CHAR_PROPERTY( id, setter ) if( name == id ) {\
- setter = value.toChar(); \
- return 0; \
- }
-
- #define SET_ITEM_PROPERTY( id, setter ) if( name == id ) {\
- setter = value.toItem(); \
- return 0; \
- }
-
struct stError;
--- 63,66 ----
***************
*** 116,128 ****
protected:
QString bindmenu_;
! UINT32 tooltip_;
QString name_;
Coord_cl pos_;
SERIAL serial_;
SERIAL multis_;
cCustomTags tags_;
protected:
- bool changed_;
// Things for building the SQL string
static void buildSqlString( QStringList &fields, QStringList &tables, QStringList &conditions );
--- 73,86 ----
protected:
QString bindmenu_;
! uint tooltip_;
QString name_;
Coord_cl pos_;
SERIAL serial_;
SERIAL multis_;
+ uchar changed_:1;
cCustomTags tags_;
+ uchar dir_:3;
protected:
// Things for building the SQL string
static void buildSqlString( QStringList &fields, QStringList &tables, QStringList &conditions );
***************
*** 177,189 ****
void changed( UI32 );
void moveTo( const Coord_cl&, bool noRemove = false );
! unsigned int dist(cUObject* d) const;
! QString bindmenu() const { return bindmenu_; }
! QString name() const { return name_; }
! Coord_cl pos() const { return pos_; }
! SERIAL serial() const { return serial_; }
! SERIAL multis() const { return multis_; }
! cCustomTags tags() const { return tags_; }
! cCustomTags& tags() { return tags_; }
! UINT32 getTooltip() const { return tooltip_; }
void setBindmenu( const QString& d ) { bindmenu_ = d; changed( SAVE ); }
--- 135,148 ----
void changed( UI32 );
void moveTo( const Coord_cl&, bool noRemove = false );
! unsigned int dist(cUObject* d) const;
! QString bindmenu() const { return bindmenu_; }
! QString name() const { return name_; }
! Coord_cl pos() const { return pos_; }
! SERIAL serial() const { return serial_; }
! SERIAL multis() const { return multis_; }
! cCustomTags tags() const { return tags_; }
! cCustomTags& tags() { return tags_; }
! UINT32 getTooltip() const { return tooltip_; }
! uchar direction() const { return dir_; }
void setBindmenu( const QString& d ) { bindmenu_ = d; changed( SAVE ); }
***************
*** 194,197 ****
--- 153,158 ----
virtual void setSerial( SERIAL d ) { serial_ = d; changed( SAVE ); }
void setTooltip( const UINT32 d ) { tooltip_ = d; }
+ void setDirection( uchar d ) { dir_ = d; changed( SAVE );}
+
virtual void sendTooltip( cUOSocket* mSock );
***************
*** 206,209 ****
--- 167,172 ----
virtual void flagUnchanged() { changed_ = false; }
+ char direction( cUObject* ) const;
+
protected:
***************
*** 298,302 ****
return 0; \
}
-
#endif // __UOBJECT_H__
--- 261,264 ----
Index: wolfpack.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wolfpack.cpp,v
retrieving revision 1.434
retrieving revision 1.435
diff -C2 -d -r1.434 -r1.435
*** wolfpack.cpp 26 Jul 2003 01:10:55 -0000 1.434
--- wolfpack.cpp 11 Aug 2003 03:34:40 -0000 1.435
***************
*** 675,679 ****
break;
default:
! clConsole.send(tr("WOLFPACK: Key %1 [%2] does not preform a fucntion.\n").arg(c).arg(QString::number(c)));
break;
}
--- 675,679 ----
break;
default:
! clConsole.send(tr("WOLFPACK: Key %1 [%2] does not preform a function.\n").arg( c > 32 ? c : '¿' ).arg(QString::number(c)));
break;
}
***************
*** 690,708 ****
if ( QFile::exists( param ) )
{
! FILE *fp = fopen(param.latin1(), "r");
! if (fp != NULL)
! {
! (void) PyRun_SimpleFile(fp, (char*)param.latin1());
! PyErr_Clear();
! fclose(fp);
}
! else
! {
! clConsole.send( QString("Can't open %1. Critical macro support data not available!\n").arg(param) );
}
}
else
clConsole.error( QString("The specified python script [%1] doesn't exist.").arg(param) );
}
}
--- 690,742 ----
if ( QFile::exists( param ) )
{
! PyObject *pName, *pModule, *pDict, *pFunc;
! PyObject *pArgs, *pValue;
! int i;
! pName = PyString_FromString( param.left(param.length() - 3).latin1() );
! /* Error checking of pName left out */
!
! pModule = PyImport_Import(pName);
! Py_DECREF(pName);
!
! if (pModule != NULL) {
! pDict = PyModule_GetDict(pModule);
! /* pDict is a borrowed reference */
!
! pFunc = PyDict_GetItemString(pDict, "main");
! /* pFun: Borrowed reference */
!
! if (pFunc && PyCallable_Check(pFunc)) {
! pArgs = PyTuple_New(0);
! pValue = PyObject_CallObject(pFunc, pArgs);
! Py_DECREF(pArgs);
! if (pValue != NULL) {
! printf("Result of call: %ld\n", PyInt_AsLong(pValue));
! Py_DECREF(pValue);
! }
! else {
! Py_DECREF(pModule);
! PyErr_Print();
! fprintf(stderr,"Call failed\n");
! return;
! }
! /* pDict and pFunc are borrowed and must not be Py_DECREF-ed */
! }
! else {
! if (PyErr_Occurred())
! PyErr_Print();
! }
! Py_DECREF(pModule);
}
! else {
! PyErr_Print();
! fprintf(stderr, "Failed to load \"%s\"\n", param.latin1());
}
+ stopPython();
+ exit(0);
}
else
clConsole.error( QString("The specified python script [%1] doesn't exist.").arg(param) );
+
}
}
***************
*** 1178,1208 ****
}
- bool ishuman(P_CHAR pc)
- {
- // Check if the Player or Npc is human! -- by Magius(CHE)
- if (pc->orgBodyID()==0x0190 || pc->orgBodyID()==0x0191) return true;
- else return false;
- }
-
- int chardir(P_CHAR a, P_CHAR b) // direction from character a to char b
- {
- int dir,xdif,ydif;
-
- xdif = b->pos().x - a->pos().x;
- ydif = b->pos().y - a->pos().y;
-
- if ((xdif==0)&&(ydif<0)) dir=0;
- else if ((xdif>0)&&(ydif<0)) dir=1;
- else if ((xdif>0)&&(ydif==0)) dir=2;
- else if ((xdif>0)&&(ydif>0)) dir=3;
- else if ((xdif==0)&&(ydif>0)) dir=4;
- else if ((xdif<0)&&(ydif>0)) dir=5;
- else if ((xdif<0)&&(ydif==0)) dir=6;
- else if ((xdif<0)&&(ydif<0)) dir=7;
- else dir=-1;
-
- return dir;
- }
-
int chardirxyz(P_CHAR pc, int x, int y) // direction from character a to char b
{
--- 1212,1215 ----
***************
*** 1438,1502 ****
{
Items->SpawnItem(socket->player(), totgold,"#",true,0x0EED,0,1);
- }
-
- int calcValue(P_ITEM pi, int value)
- {
- int mod=10;
- if (pi == NULL)
- return value;
-
- if( pi->type() == 19 )
- {
- if (pi->morex()>500)
- mod =mod+1;
- if (pi->morex()>900) mod=mod+1;
- if (pi->morex()>1000) mod=mod+1;
- if (pi->morez()>1) mod=mod+(3*(pi->morez()-1));
- value=(value*mod)/10;
- }
-
- // Lines added for Rank System by Magius(CHE)
- if (pi->rank()>0 && pi->rank()<10 && SrvParams->rank_system()==1)
- {
- value=(int) (pi->rank()*value)/10;
- }
- if (value<1) value=1;
- // end addon
-
- // Lines added for Trade System by Magius(CHE) (2)
- if (pi->rndvaluerate()<0) pi->setRndValueRate(0);
- if (pi->rndvaluerate()!=0 && SrvParams->trade_system()==1) {
- value+=(int) (value*pi->rndvaluerate())/1000;
- }
- if (value<1) value=1;
- // end addon
-
- return value;
- }
-
- int calcGoodValue(P_CHAR npcnum2, P_ITEM pi, int value,int goodtype)
- { // Function Created by Magius(CHE) for trade System
- cTerritory* Region = AllTerritories::instance()->region( npcnum2->pos().x, npcnum2->pos().y, npcnum2->pos().map );
-
- int regvalue=0;
- int x;
- if( pi == NULL || Region == NULL )
- return value;
-
- int good=pi->good();
-
- if (good<=-1 || good >255 ) return value;
-
- if (goodtype==1) regvalue=Region->tradesystem_[good].sellable; // Vendor SELL
- if (goodtype==0) regvalue=Region->tradesystem_[good].buyable; // Vendor BUY
-
- x=(int) (value*abs(regvalue))/1000;
-
- if (regvalue<0) value-=x;
- else value+=x;
-
- if (value<=0) value=1; // Added by Magius(CHE) (2)
-
- return value;
}
--- 1445,1448 ----
|