Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11602
Modified Files:
accounts.cpp basechar.cpp boats.cpp corpse.cpp house.cpp
items.cpp multis.cpp npc.cpp player.cpp resources.cpp
uobject.cpp world.cpp
Log Message:
This doesn't appear to break anything... I've noticed that a lot of SQL
queries don't have the ` for `field` `table` stuff, using them helps prevent
errors and can also increase responce times with MySQL. By doing this, I
seem to be getting slightly lower save times than before, about 5-40ms.
Assuming this really doesn't break anything, might be good to do this with
other mysql queries...
Index: accounts.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/accounts.cpp,v
retrieving revision 1.78
retrieving revision 1.79
diff -C2 -d -r1.78 -r1.79
*** accounts.cpp 30 Jan 2004 18:07:38 -0000 1.78
--- accounts.cpp 30 Jan 2004 20:29:25 -0000 1.79
***************
*** 43,55 ****
// DB AutoCreation
! const char *createSql = "CREATE TABLE accounts (\
! login varchar(255) NOT NULL default '',\
! password varchar(255) NOT NULL default '',\
! flags int NOT NULL default '0',\
! acl varchar(255) NOT NULL default 'player',\
! lastlogin int NOT NULL default '',\
! blockuntil int NOT NULL default '',\
! PRIMARY KEY (login)\
! );";
/*****************************************************************************
--- 43,55 ----
// DB AutoCreation
! const char *createSql = "CREATE TABLE `accounts` (\
! `login` varchar(255) NOT NULL default '',\
! `password` varchar(255) NOT NULL default '',\
! `flags` int NOT NULL default '0',\
! `acl` varchar(255) NOT NULL default 'player',\
! `lastlogin` int NOT NULL default '',\
! `blockuntil` int NOT NULL default '',\
! PRIMARY KEY (`login`)\
! );";
/*****************************************************************************
***************
*** 237,241 ****
iterator it = accounts.begin();
for (; it != accounts.end(); ++it)
! delete it.data();
}
--- 237,241 ----
iterator it = accounts.begin();
for (; it != accounts.end(); ++it)
! delete it.data();
}
***************
*** 249,253 ****
// First we check for blocked account.
if ( it.data()->isBlocked() )
! {
if( error )
*error = Banned;
--- 249,253 ----
// First we check for blocked account.
if ( it.data()->isBlocked() )
! {
if( error )
*error = Banned;
***************
*** 262,266 ****
}
! // Ok, let´s continue.
if (it.data()->password() == password)
{
--- 262,266 ----
}
! // Ok, lets continue.
if (it.data()->password() == password)
{
***************
*** 312,324 ****
persistentBroker->executeQuery( "BEGIN;" );
! persistentBroker->executeQuery( "DELETE FROM accounts;" );
iterator it = accounts.begin();
for (; it != accounts.end(); ++it)
{
! // INSERT
cAccount *account = it.data();
!
! QString sql( "INSERT INTO accounts VALUES( '%1', '%2', %3, '%4', %5, %6 );" );
sql = sql.arg( account->login_.lower() ).arg( account->password_ ).arg( account->flags_ ).arg( account->aclName_ ).arg( !account->lastLogin_.isNull() ? account->lastLogin_.toTime_t() : 0 ).arg( !account->blockUntil.isNull() ? account->blockUntil.toTime_t() : 0 );
--- 312,324 ----
persistentBroker->executeQuery( "BEGIN;" );
! persistentBroker->executeQuery( "DELETE FROM `accounts`;" );
iterator it = accounts.begin();
for (; it != accounts.end(); ++it)
{
! // INSERT
cAccount *account = it.data();
!
! QString sql( "INSERT INTO `accounts` VALUES( '%1', '%2', %3, '%4', %5, %6 );" );
sql = sql.arg( account->login_.lower() ).arg( account->password_ ).arg( account->flags_ ).arg( account->aclName_ ).arg( !account->lastLogin_.isNull() ? account->lastLogin_.toTime_t() : 0 ).arg( !account->blockUntil.isNull() ? account->blockUntil.toTime_t() : 0 );
***************
*** 340,344 ****
persistentBroker->executeQuery( "ROLLBACK;" );
Console::instance()->log( LOG_ERROR, "Unknown error while saving Accounts." );
! }
}
--- 340,344 ----
persistentBroker->executeQuery( "ROLLBACK;" );
Console::instance()->log( LOG_ERROR, "Unknown error while saving Accounts." );
! }
}
***************
*** 366,370 ****
}
! cDBResult result = persistentBroker->query( "SELECT accounts.login,accounts.password,accounts.flags,accounts.acl,accounts.lastlogin,accounts.blockuntil FROM accounts;" );
// Clear Accounts HERE
--- 366,370 ----
}
! cDBResult result = persistentBroker->query( "SELECT `login`,`password`,`flags`,`acl`,`lastlogin`,`blockuntil` FROM `accounts`;" );
// Clear Accounts HERE
***************
*** 396,400 ****
{
Console::instance()->log( LOG_ERROR, "Unknown error while loading Accounts" );
! }
}
--- 396,400 ----
{
Console::instance()->log( LOG_ERROR, "Unknown error while loading Accounts" );
! }
}
***************
*** 449,453 ****
/*!
Creates an account with \a login and \a password. If this is the first account
! on the system, it will be set with "admin" acl, otherwise, it will default to
"player" acl.
*/
--- 449,453 ----
/*!
Creates an account with \a login and \a password. If this is the first account
! on the system, it will be set with "admin" acl, otherwise, it will default to
"player" acl.
*/
Index: basechar.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/basechar.cpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -d -r1.53 -r1.54
*** basechar.cpp 30 Jan 2004 15:28:49 -0000 1.53
--- basechar.cpp 30 Jan 2004 20:29:25 -0000 1.54
***************
*** 202,211 ****
attackerSerial_ = atoi( result[offset++] );
combatTarget_ = atoi( result[offset++] );
! murdererSerial_ = atoi( result[offset++] );
ser = atoi( result[offset++] );
guarding_ = dynamic_cast<P_PLAYER>(FindCharBySerial( ser ));
!
// Query the Skills for this character
! QString sql = "SELECT skills.skill,skills.value,skills.locktype,skills.cap FROM skills WHERE serial = '" + QString::number( serial() ) + "'";
cDBResult res = persistentBroker->query( sql );
--- 202,211 ----
attackerSerial_ = atoi( result[offset++] );
combatTarget_ = atoi( result[offset++] );
! murdererSerial_ = atoi( result[offset++] );
ser = atoi( result[offset++] );
guarding_ = dynamic_cast<P_PLAYER>(FindCharBySerial( ser ));
!
// Query the Skills for this character
! QString sql = "SELECT `skill`,`value`,`locktype`,`cap` FROM `skills` WHERE `serial` = '" + QString::number( serial() ) + "'";
cDBResult res = persistentBroker->query( sql );
***************
*** 248,254 ****
initSave;
setTable( "characters" );
!
addField( "serial", serial() );
! addStrField( "name", orgName_ );
addStrField( "title", title_ );
addStrField( "creationdate", creationDate_.toString() );
--- 248,254 ----
initSave;
setTable( "characters" );
!
addField( "serial", serial() );
! addStrField( "name", orgName_ );
addStrField( "title", title_ );
addStrField( "creationdate", creationDate_.toString() );
***************
*** 290,294 ****
addCondition( "serial", serial() );
saveFields;
!
QValueVector< stSkillValue >::const_iterator it;
int i = 0;
--- 290,294 ----
addCondition( "serial", serial() );
saveFields;
!
QValueVector< stSkillValue >::const_iterator it;
int i = 0;
***************
*** 314,323 ****
bool cBaseChar::del()
! {
if( !isPersistent )
return false; // We didn't need to delete the object
! persistentBroker->addToDeleteQueue( "characters", QString( "serial = '%1'" ).arg( serial() ) );
! persistentBroker->addToDeleteQueue( "skills", QString( "serial = '%1'" ).arg( serial() ) );
changed_ = true;
return cUObject::del();
--- 314,323 ----
bool cBaseChar::del()
! {
if( !isPersistent )
return false; // We didn't need to delete the object
! persistentBroker->addToDeleteQueue( "characters", QString( "`serial` = '%1'" ).arg( serial() ) );
! persistentBroker->addToDeleteQueue( "skills", QString( "`serial` = '%1'" ).arg( serial() ) );
changed_ = true;
return cUObject::del();
***************
*** 328,332 ****
World::instance()->registerObject( pc );
pc->setRegion( AllTerritories::instance()->region( pc->pos().x, pc->pos().y, pc->pos().map ) );
!
if (pc->bodyID() <= 0x3e1)
{
--- 328,332 ----
World::instance()->registerObject( pc );
pc->setRegion( AllTerritories::instance()->region( pc->pos().x, pc->pos().y, pc->pos().map ) );
!
if (pc->bodyID() <= 0x3e1)
{
***************
*** 343,348 ****
}
}
! }
!
UINT16 max_x = Map->mapTileWidth(pc->pos().map) * 8;
UINT16 max_y = Map->mapTileHeight(pc->pos().map) * 8;
--- 343,348 ----
}
}
! }
!
UINT16 max_x = Map->mapTileWidth(pc->pos().map) * 8;
UINT16 max_y = Map->mapTileHeight(pc->pos().map) * 8;
***************
*** 353,357 ****
cCharStuff::DeleteChar( pc );
return;
! }
}
--- 353,357 ----
cCharStuff::DeleteChar( pc );
return;
! }
}
***************
*** 377,381 ****
if( !pPlayer || !pPlayer->socket() || !pPlayer->inRange( this, pPlayer->visualRange() ) || ( isHidden() && !pPlayer->isGM() && this != pPlayer ) )
continue;
!
pPlayer->socket()->updateHealth( this );
}
--- 377,381 ----
if( !pPlayer || !pPlayer->socket() || !pPlayer->inRange( this, pPlayer->visualRange() ) || ( isHidden() && !pPlayer->isGM() && this != pPlayer ) )
continue;
!
pPlayer->socket()->updateHealth( this );
}
***************
*** 392,403 ****
else if( mounted && ( id == 0x0D || id == 0x14 ) )
id = 0x1D;
!
// Attack (1H,Side,Down) + Cast Directed
else if( mounted && ( id == 0x09 || id == 0x0a ||id == 0x0b ||id == 0x10 ) )
id = 0x1A;
!
// Bow + Salute + Eat
else if( mounted && ( id == 0x13 || id == 0x20 || id == 0x21 || id == 0x22 ) )
! id = 0x1C;
else if( ( mounted || bodyID_ < 0x190 ) && ( bodyID_ == 0x22 ) )
--- 392,403 ----
else if( mounted && ( id == 0x0D || id == 0x14 ) )
id = 0x1D;
!
// Attack (1H,Side,Down) + Cast Directed
else if( mounted && ( id == 0x09 || id == 0x0a ||id == 0x0b ||id == 0x10 ) )
id = 0x1A;
!
// Bow + Salute + Eat
else if( mounted && ( id == 0x13 || id == 0x20 || id == 0x21 || id == 0x22 ) )
! id = 0x1C;
else if( ( mounted || bodyID_ < 0x190 ) && ( bodyID_ == 0x22 ) )
***************
*** 422,426 ****
{
// Check if we have something on our right hand
! P_ITEM rightHand = rightHandItem();
if( Combat::weaponSkill( rightHand ) != WRESTLING )
return rightHand;
--- 422,426 ----
{
// Check if we have something on our right hand
! P_ITEM rightHand = rightHandItem();
if( Combat::weaponSkill( rightHand ) != WRESTLING )
return rightHand;
***************
*** 442,447 ****
}
! void cBaseChar::setHairColor( UINT16 d)
! {
changed_ = true;
cItem* pHair = GetItemOnLayer( 11 );
--- 442,447 ----
}
! void cBaseChar::setHairColor( UINT16 d)
! {
changed_ = true;
cItem* pHair = GetItemOnLayer( 11 );
***************
*** 452,457 ****
}
! void cBaseChar::setHairStyle( UINT16 d)
! {
if( !isHair( d ) )
return;
--- 452,457 ----
}
! void cBaseChar::setHairStyle( UINT16 d)
! {
if( !isHair( d ) )
return;
***************
*** 476,481 ****
}
! void cBaseChar::setBeardColor( UINT16 d)
! {
changed_ = true;
cItem* pBeard = GetItemOnLayer( 16 );
--- 476,481 ----
}
! void cBaseChar::setBeardColor( UINT16 d)
! {
changed_ = true;
cItem* pBeard = GetItemOnLayer( 16 );
***************
*** 486,491 ****
}
! void cBaseChar::setBeardStyle( UINT16 d)
! {
if( !isBeard( d ) )
return;
--- 486,491 ----
}
! void cBaseChar::setBeardStyle( UINT16 d)
! {
if( !isBeard( d ) )
return;
***************
*** 539,543 ****
}
! // This should check soon if we are standing above our
// corpse and if so, merge with our corpse instead of
// just resurrecting
--- 539,543 ----
}
! // This should check soon if we are standing above our
// corpse and if so, merge with our corpse instead of
// just resurrecting
***************
*** 569,573 ****
pRobe = cItem::createFromScript( "1f03" );
! if( !pRobe )
return;
--- 569,573 ----
pRobe = cItem::createFromScript( "1f03" );
! if( !pRobe )
return;
***************
*** 588,608 ****
UINT8 nDir;
! if( xdif == 0 && ydif < 0 )
nDir = 0;
! else if( xdif > 0 && ydif < 0 )
nDir = 1;
! else if( xdif > 0 && ydif ==0 )
nDir = 2;
! else if( xdif > 0 && ydif > 0 )
nDir = 3;
! else if( xdif ==0 && ydif > 0 )
nDir = 4;
! else if( xdif < 0 && ydif > 0 )
nDir = 5;
! else if( xdif < 0 && ydif ==0 )
nDir = 6;
! else if( xdif < 0 && ydif < 0 )
nDir = 7;
! else
return;
--- 588,608 ----
UINT8 nDir;
! if( xdif == 0 && ydif < 0 )
nDir = 0;
! else if( xdif > 0 && ydif < 0 )
nDir = 1;
! else if( xdif > 0 && ydif ==0 )
nDir = 2;
! else if( xdif > 0 && ydif > 0 )
nDir = 3;
! else if( xdif ==0 && ydif > 0 )
nDir = 4;
! else if( xdif < 0 && ydif > 0 )
nDir = 5;
! else if( xdif < 0 && ydif ==0 )
nDir = 6;
! else if( xdif < 0 && ydif < 0 )
nDir = 7;
! else
return;
***************
*** 628,632 ****
if( !pi->container() )
! {
pi->setLayer( 0 );
if( !layer )
--- 628,632 ----
if( !pi->container() )
! {
pi->setLayer( 0 );
if( !layer )
***************
*** 647,651 ****
packet.fromItem( pi );
for ( cUOSocket* socket = cNetwork::instance()->first(); socket != 0; socket = cNetwork::instance()->next() )
! if( socket->player() && socket->player()->inRange( this, socket->player()->visualRange() ) )
socket->send( &packet );
}
--- 647,651 ----
packet.fromItem( pi );
for ( cUOSocket* socket = cNetwork::instance()->first(); socket != 0; socket = cNetwork::instance()->next() )
! if( socket->player() && socket->player()->inRange( this, socket->player()->visualRange() ) )
socket->send( &packet );
}
***************
*** 682,686 ****
P_ITEM pi = getBackpack();
!
if( pi )
number = pi->CountItems( ID, col );
--- 682,686 ----
P_ITEM pi = getBackpack();
!
if( pi )
number = pi->CountItems( ID, col );
***************
*** 698,702 ****
}
! P_ITEM cBaseChar::getBackpack()
{
P_ITEM backpack = atLayer( Backpack );
--- 698,702 ----
}
! P_ITEM cBaseChar::getBackpack()
{
P_ITEM backpack = atLayer( Backpack );
***************
*** 729,733 ****
cUObject::setSerial( ser );
!
World::instance()->registerObject( this );
}
--- 729,733 ----
cUObject::setSerial( ser );
!
World::instance()->registerObject( this );
}
***************
*** 741,747 ****
}
! bool cBaseChar::Wears(P_ITEM pi)
! {
! return (this == pi->container());
}
--- 741,747 ----
}
! bool cBaseChar::Wears(P_ITEM pi)
! {
! return (this == pi->container());
}
***************
*** 789,793 ****
textSpeech.setColor( color );
textSpeech.setText( emote );
!
for( cUOSocket *mSock = cNetwork::instance()->first(); mSock; mSock = cNetwork::instance()->next() )
if( mSock->player() && mSock->player()->inRange( this, mSock->player()->visualRange() ) )
--- 789,793 ----
textSpeech.setColor( color );
textSpeech.setText( emote );
!
for( cUOSocket *mSock = cNetwork::instance()->first(); mSock; mSock = cNetwork::instance()->next() )
if( mSock->player() && mSock->player()->inRange( this, mSock->player()->visualRange() ) )
***************
*** 797,801 ****
UI16 cBaseChar::calcDefense( enBodyParts bodypart, bool wearout )
{
! P_ITEM pHitItem = NULL;
UI16 total = bodyArmor_; // the body armor is base value
--- 797,801 ----
UI16 cBaseChar::calcDefense( enBodyParts bodypart, bool wearout )
{
! P_ITEM pHitItem = NULL;
UI16 total = bodyArmor_; // the body armor is base value
***************
*** 803,816 ****
{
P_ITEM pShield = leftHandItem();
!
! // Displayed AR = ((Parrying Skill * Base AR of Shield) ÷ 200) + 1
if( pShield && IsShield( pShield->id() ) )
total += ( (UI16)( (float)( skillValue( PARRYING ) * pShield->def() ) / 200.0f ) + 1 );
! }
! if( skillValue( PARRYING ) >= 1000 )
! total += 5; // gm parry bonus.
! P_ITEM pi;
ItemContainer::const_iterator it = content_.begin();
--- 803,816 ----
{
P_ITEM pShield = leftHandItem();
!
! // Displayed AR = ((Parrying Skill * Base AR of Shield) �200) + 1
if( pShield && IsShield( pShield->id() ) )
total += ( (UI16)( (float)( skillValue( PARRYING ) * pShield->def() ) / 200.0f ) + 1 );
! }
! if( skillValue( PARRYING ) >= 1000 )
! total += 5; // gm parry bonus.
! P_ITEM pi;
ItemContainer::const_iterator it = content_.begin();
***************
*** 818,826 ****
{
pi = *it;
! if( pi && pi->layer() > 1 && pi->layer() < 25 )
! {
! //blackwinds new stuff
UI16 effdef = 0;
! if( pi->maxhp() > 0 )
effdef = (UI16)( (float)pi->hp() / (float)pi->maxhp() * (float)pi->def() );
--- 818,826 ----
{
pi = *it;
! if( pi && pi->layer() > 1 && pi->layer() < 25 )
! {
! //blackwinds new stuff
UI16 effdef = 0;
! if( pi->maxhp() > 0 )
effdef = (UI16)( (float)pi->hp() / (float)pi->maxhp() * (float)pi->def() );
***************
*** 834,903 ****
}
}
! else
! {
! switch( pi->layer() )
! {
! case 5:
! case 13:
! case 17:
! case 20:
! case 22:
! if( bodypart == BODY )
! {
! total += effdef;
! pHitItem = pi;
! }
! break;
! case 19:
! if( bodypart == ARMS )
! {
! total += effdef;
! pHitItem = pi;
! }
! break;
! case 6:
! if( bodypart == HEAD )
! {
! total += effdef;
! pHitItem = pi;
! }
! break;
! case 3:
! case 4:
! case 12:
! case 23:
! case 24:
if( bodypart == LEGS )
! {
! total += effdef;
! pHitItem = pi;
! }
! break;
! case 10:
! if( bodypart == NECK )
! {
! total += effdef;
! pHitItem = pi;
! }
! break;
! case 7:
if( bodypart == HANDS )
! {
! total += effdef;
! pHitItem = pi;
! }
! break;
! default:
! break;
! }
}
}
++it;
! }
! if( pHitItem )
! {
! // don't damage hairs, beard and backpack
! // important! this sometimes cause backpack destroy!
if( pHitItem->layer() != 0x0B && pHitItem->layer() != 0x10 && pHitItem->layer() != 0x15 )
{
--- 834,903 ----
}
}
! else
! {
! switch( pi->layer() )
! {
! case 5:
! case 13:
! case 17:
! case 20:
! case 22:
! if( bodypart == BODY )
! {
! total += effdef;
! pHitItem = pi;
! }
! break;
! case 19:
! if( bodypart == ARMS )
! {
! total += effdef;
! pHitItem = pi;
! }
! break;
! case 6:
! if( bodypart == HEAD )
! {
! total += effdef;
! pHitItem = pi;
! }
! break;
! case 3:
! case 4:
! case 12:
! case 23:
! case 24:
if( bodypart == LEGS )
! {
! total += effdef;
! pHitItem = pi;
! }
! break;
! case 10:
! if( bodypart == NECK )
! {
! total += effdef;
! pHitItem = pi;
! }
! break;
! case 7:
if( bodypart == HANDS )
! {
! total += effdef;
! pHitItem = pi;
! }
! break;
! default:
! break;
! }
}
}
++it;
! }
! if( pHitItem )
! {
! // don't damage hairs, beard and backpack
! // important! this sometimes cause backpack destroy!
if( pHitItem->layer() != 0x0B && pHitItem->layer() != 0x10 && pHitItem->layer() != 0x15 )
{
***************
*** 905,911 ****
}
}
!
// Base AR ?
! /*if( total < 2 && bodypart == ALLBODYPARTS )
total = 2;*/
--- 905,911 ----
}
}
!
// Base AR ?
! /*if( total < 2 && bodypart == ALLBODYPARTS )
total = 2;*/
***************
*** 916,920 ****
{
bool success = false;
!
// Maximum Value of 120 for checks
// I disabled this so you can make skillchecks for grandmasters that are still tough
--- 916,920 ----
{
bool success = false;
!
// Maximum Value of 120 for checks
// I disabled this so you can make skillchecks for grandmasters that are still tough
***************
*** 923,928 ****
// How far is the players skill above the required minimum.
! int charrange = skillValue( skill ) - min;
!
if( charrange < 0 )
charrange = 0;
--- 923,928 ----
// How far is the players skill above the required minimum.
! int charrange = skillValue( skill ) - min;
!
if( charrange < 0 )
charrange = 0;
***************
*** 934,944 ****
// +100 means: *allways* a minimum of 10% for success
float chance = ( ( (float) charrange * 890.0f ) / (float)( max - min ) ) + 100.0f;
!
! if( chance > 990 )
chance = 990; // *allways* a 1% chance of failure
!
if( chance >= RandomNum( 0, 1000 ) )
success = true;
!
return success;
}
--- 934,944 ----
// +100 means: *allways* a minimum of 10% for success
float chance = ( ( (float) charrange * 890.0f ) / (float)( max - min ) ) + 100.0f;
!
! if( chance > 990 )
chance = 990; // *allways* a 1% chance of failure
!
if( chance >= RandomNum( 0, 1000 ) )
success = true;
!
return success;
}
***************
*** 1007,1011 ****
}
++iter;
! }
}
--- 1007,1011 ----
}
++iter;
! }
}
***************
*** 1021,1025 ****
if( TagName == "bindmenu" )
{
! if( !Tag->getAttribute( "id" ).isNull() )
this->setBindmenu(Tag->getAttribute( "id" ));
else
--- 1021,1025 ----
if( TagName == "bindmenu" )
{
! if( !Tag->getAttribute( "id" ).isNull() )
this->setBindmenu(Tag->getAttribute( "id" ));
else
***************
*** 1102,1106 ****
stamina_ = maxStamina_;
}
!
else if( TagName == "int" )
{
--- 1102,1106 ----
stamina_ = maxStamina_;
}
!
else if( TagName == "int" )
{
***************
*** 1194,1198 ****
mLayer = tInfo.layer;
}
!
if( !mLayer )
pItem->remove();
--- 1194,1198 ----
mLayer = tInfo.layer;
}
!
if( !mLayer )
pItem->remove();
***************
*** 1221,1225 ****
setSkillValue( skillId, Value.toInt() );
}
!
}
--- 1221,1225 ----
setSkillValue( skillId, Value.toInt() );
}
!
}
***************
*** 1228,1232 ****
// DoubleEquip is *NOT* allowed
if ( atLayer( layer ) != 0 )
! {
log( LOG_WARNING, QString( "Trying to put an item on layer %1 which is already occupied\n" ).arg( layer ) );
pi->setContainer( 0 );
--- 1228,1232 ----
// DoubleEquip is *NOT* allowed
if ( atLayer( layer ) != 0 )
! {
log( LOG_WARNING, QString( "Trying to put an item on layer %1 which is already occupied\n" ).arg( layer ) );
pi->setContainer( 0 );
***************
*** 1239,1243 ****
if( layer != Dragging )
pi->onEquip( this, layer );
! pi->removeFromCont();
}
--- 1239,1243 ----
if( layer != Dragging )
pi->onEquip( this, layer );
! pi->removeFromCont();
}
***************
*** 1516,1520 ****
else GET_PROPERTY( "invisible", isInvisible() )
else GET_PROPERTY( "frozen", isFrozen() )
!
// skill.
else if( name.left( 6 ) == "skill." )
--- 1516,1520 ----
else GET_PROPERTY( "invisible", isInvisible() )
else GET_PROPERTY( "frozen", isFrozen() )
!
// skill.
else if( name.left( 6 ) == "skill." )
***************
*** 1638,1647 ****
{
PyObject *args;
!
if( dynamic_cast< P_CHAR >( source ) != 0 )
args = Py_BuildValue( "O&iiO&", PyGetCharObject, this, (unsigned int)type, amount, PyGetCharObject, source );
else if( dynamic_cast< P_ITEM >( source ) )
args = Py_BuildValue( "O&iiO&", PyGetCharObject, this, (unsigned int)type, amount, PyGetItemObject, source );
!
PyObject *result = cPythonScript::callChainedEvent( EVENT_DAMAGE, scriptChain, args );
--- 1638,1647 ----
{
PyObject *args;
!
if( dynamic_cast< P_CHAR >( source ) != 0 )
args = Py_BuildValue( "O&iiO&", PyGetCharObject, this, (unsigned int)type, amount, PyGetCharObject, source );
else if( dynamic_cast< P_ITEM >( source ) )
args = Py_BuildValue( "O&iiO&", PyGetCharObject, this, (unsigned int)type, amount, PyGetItemObject, source );
!
PyObject *result = cPythonScript::callChainedEvent( EVENT_DAMAGE, scriptChain, args );
***************
*** 1675,1679 ****
updateHealth();
Combat::playGetHitSoundEffect( this );
! Combat::playGetHitAnimation( this );
}
--- 1675,1679 ----
updateHealth();
Combat::playGetHitSoundEffect( this );
! Combat::playGetHitAnimation( this );
}
***************
*** 1717,1721 ****
if( type == Bark_GetHit )
return;
!
// Only Attack, Hit, GetHit and Death
case 3:
--- 1717,1721 ----
if( type == Bark_GetHit )
return;
!
// Only Attack, Hit, GetHit and Death
case 3:
***************
*** 1844,1848 ****
{
bool result = false;
!
if( scriptChain )
{
--- 1844,1848 ----
{
bool result = false;
!
if( scriptChain )
{
***************
*** 1858,1862 ****
{
bool result = false;
!
if( scriptChain )
{
--- 1858,1862 ----
{
bool result = false;
!
if( scriptChain )
{
***************
*** 1872,1876 ****
{
bool result = false;
!
if( scriptChain )
{
--- 1872,1876 ----
{
bool result = false;
!
if( scriptChain )
{
***************
*** 1886,1890 ****
{
bool result = false;
!
if( scriptChain )
{
--- 1886,1890 ----
{
bool result = false;
!
if( scriptChain )
{
***************
*** 1902,1910 ****
}
! bool cBaseChar::onSkillUse( unsigned char skill )
{
cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_SKILLUSE );
bool result = false;
!
if( scriptChain || global )
{
--- 1902,1910 ----
}
! bool cBaseChar::onSkillUse( unsigned char skill )
{
cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_SKILLUSE );
bool result = false;
!
if( scriptChain || global )
{
***************
*** 1925,1929 ****
{
bool result = false;
!
if( scriptChain )
{
--- 1925,1929 ----
{
bool result = false;
!
if( scriptChain )
{
***************
*** 1967,1971 ****
{
bool result = false;
!
if( scriptChain )
{
--- 1967,1971 ----
{
bool result = false;
!
if( scriptChain )
{
***************
*** 1981,1985 ****
cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_CHLEVELCHANGE );
bool result = false;
!
if( scriptChain || global )
{
--- 1981,1985 ----
cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_CHLEVELCHANGE );
bool result = false;
!
if( scriptChain || global )
{
***************
*** 2001,2005 ****
cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_SHOWTOOLTIP );
bool result = false;
!
if( scriptChain || global )
{
--- 2001,2005 ----
cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_SHOWTOOLTIP );
bool result = false;
!
if( scriptChain || global )
{
***************
*** 2021,2025 ****
cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_SKILLGAIN );
bool result = false;
!
if( scriptChain || global )
{
--- 2021,2025 ----
cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_SKILLGAIN );
bool result = false;
!
if( scriptChain || global )
{
***************
*** 2041,2045 ****
cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_STATGAIN );
bool result = false;
!
if( scriptChain || global )
{
--- 2041,2045 ----
cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_STATGAIN );
bool result = false;
!
if( scriptChain || global )
{
Index: boats.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/boats.cpp,v
retrieving revision 1.116
retrieving revision 1.117
diff -C2 -d -r1.116 -r1.117
*** boats.cpp 24 Sep 2003 21:19:47 -0000 1.116
--- boats.cpp 30 Jan 2004 20:29:26 -0000 1.117
***************
*** 53,57 ****
#undef DBGFILE
! #define DBGFILE "boats.cpp"
cBoat::cBoat() : cMulti()
--- 53,57 ----
#undef DBGFILE
! #define DBGFILE "boats.cpp"
cBoat::cBoat() : cMulti()
***************
*** 69,73 ****
this->itemids[2][0] = this->itemids[0][2] = 0x3EB2;
this->itemids[3][0] = this->itemids[1][2] = 0x3E85;
!
this->itemids[0][1] = this->itemids[2][3] = 0x3ED5;
this->itemids[1][1] = this->itemids[3][3] = 0x3E89;
--- 69,73 ----
this->itemids[2][0] = this->itemids[0][2] = 0x3EB2;
this->itemids[3][0] = this->itemids[1][2] = 0x3E85;
!
this->itemids[0][1] = this->itemids[2][3] = 0x3ED5;
this->itemids[1][1] = this->itemids[3][3] = 0x3E89;
***************
*** 162,168 ****
pTiller->setTag("gatetime", (int)(uiCurrentTime + (double)(SrvParams->boatSpeed()*MY_CLOCKS_PER_SEC)));
}
!
P_ITEM pPlankR = cItem::createFromId( this->itemids[0][ PORT_P_C ] );
! if( !pPlankR )
siproblem = 1;
else
--- 162,168 ----
pTiller->setTag("gatetime", (int)(uiCurrentTime + (double)(SrvParams->boatSpeed()*MY_CLOCKS_PER_SEC)));
}
!
P_ITEM pPlankR = cItem::createFromId( this->itemids[0][ PORT_P_C ] );
! if( !pPlankR )
siproblem = 1;
else
***************
*** 241,245 ****
socket->send( &uoResume );
}
!
this->SetOwnSerial( pc_currchar->serial() );
}
--- 241,245 ----
socket->send( &uoResume );
}
!
this->SetOwnSerial( pc_currchar->serial() );
}
***************
*** 373,377 ****
coord = Y;
}
!
if( coord < 0xFF )
{
--- 373,377 ----
coord = Y;
}
!
if( coord < 0xFF )
{
***************
*** 415,425 ****
if( mapblocks )
return false;
!
/*
RegionIterator4Items ri( Coord_cl( multi.x + posx, multi.y + posy, pos().z, pos.map ) );
! for( ri.Begin(); !ri.atEnd(); ri++ )
{
P_ITEM pi = ri.GetData();
! if( ( pi != NULL ) && ( pi->serial() != this->serial() ) && ( pi->pos().x == (multi.x + posx) ) && ( pi->pos().y == (multi.y + posy) ) )
return false;
}
--- 415,425 ----
if( mapblocks )
return false;
!
/*
RegionIterator4Items ri( Coord_cl( multi.x + posx, multi.y + posy, pos().z, pos.map ) );
! for( ri.Begin(); !ri.atEnd(); ri++ )
{
P_ITEM pi = ri.GetData();
! if( ( pi != NULL ) && ( pi->serial() != this->serial() ) && ( pi->pos().x == (multi.x + posx) ) && ( pi->pos().y == (multi.y + posy) ) )
return false;
}
***************
*** 434,448 ****
if( pTiller == NULL )
return;
!
P_ITEM pPortplank = FindItemBySerial( this->itemserials[ PORT_PLANK ] );
! if( pPortplank == NULL )
return;
P_ITEM pStarplank = FindItemBySerial( this->itemserials[ STARB_PLANK ] );
! if( pStarplank == NULL )
return;
P_ITEM pHold = FindItemBySerial( this->itemserials[ HOLD ] );
! if( pHold == NULL )
return;
--- 434,448 ----
if( pTiller == NULL )
return;
!
P_ITEM pPortplank = FindItemBySerial( this->itemserials[ PORT_PLANK ] );
! if( pPortplank == NULL )
return;
P_ITEM pStarplank = FindItemBySerial( this->itemserials[ STARB_PLANK ] );
! if( pStarplank == NULL )
return;
P_ITEM pHold = FindItemBySerial( this->itemserials[ HOLD ] );
! if( pHold == NULL )
return;
***************
*** 459,463 ****
newboatdir+=2;
}
! else if( turn < 0 )
{
if( this->boatdir <= 1 )
--- 459,463 ----
newboatdir+=2;
}
! else if( turn < 0 )
{
if( this->boatdir <= 1 )
***************
*** 476,483 ****
uoPacket.pause();
RegionIterator4Chars ri( pos() );
! for( ri.Begin(); !ri.atEnd(); ri++ )
{
P_PLAYER pc = dynamic_cast<P_PLAYER>(ri.GetData());
! if( pc != NULL )
{
cUOSocket* socket = pc->socket();
--- 476,483 ----
uoPacket.pause();
RegionIterator4Chars ri( pos() );
! for( ri.Begin(); !ri.atEnd(); ri++ )
{
P_PLAYER pc = dynamic_cast<P_PLAYER>(ri.GetData());
! if( pc != NULL )
{
cUOSocket* socket = pc->socket();
***************
*** 501,505 ****
this->id_ = this->multiids_[ shortboatdir ];
this->boatdir = newboatdir;
!
// turn all items and chars on the boat and send them
QValueList< SERIAL > toremove;
--- 501,505 ----
this->id_ = this->multiids_[ shortboatdir ];
this->boatdir = newboatdir;
!
// turn all items and chars on the boat and send them
QValueList< SERIAL > toremove;
***************
*** 511,515 ****
if( pc && pc->pos().x != 0 && pc->pos().y != 0 && pc->pos().z != 0 ) // dont move mounted animals, that were mounted when user was on boat
{
! UI16 newx = pc->pos().x;
UI16 newy = pc->pos().y;
dx = this->pos().x - newx;
--- 511,515 ----
if( pc && pc->pos().x != 0 && pc->pos().y != 0 && pc->pos().z != 0 ) // dont move mounted animals, that were mounted when user was on boat
{
! UI16 newx = pc->pos().x;
UI16 newy = pc->pos().y;
dx = this->pos().x - newx;
***************
*** 608,622 ****
pPortplank->pos().z );
pPortplank->setId( itemids[shortboatdir][PORT_P_C] );
!
pStarplank->MoveTo( pos().x + itemoffsets[shortboatdir][STARB_PLANK][X],
pos().y + itemoffsets[shortboatdir][STARB_PLANK][Y],
pStarplank->pos().z );
pStarplank->setId( itemids[shortboatdir][STAR_P_C] );
!
pTiller->MoveTo( pos().x + itemoffsets[shortboatdir][TILLER][X],
pos().y + itemoffsets[shortboatdir][TILLER][Y],
pTiller->pos().z );
pTiller->setId( itemids[shortboatdir][TILLER_ID] );
!
pHold->MoveTo( pos().x + itemoffsets[shortboatdir][HOLD][X],
pos().y + itemoffsets[shortboatdir][HOLD][Y],
--- 608,622 ----
pPortplank->pos().z );
pPortplank->setId( itemids[shortboatdir][PORT_P_C] );
!
pStarplank->MoveTo( pos().x + itemoffsets[shortboatdir][STARB_PLANK][X],
pos().y + itemoffsets[shortboatdir][STARB_PLANK][Y],
pStarplank->pos().z );
pStarplank->setId( itemids[shortboatdir][STAR_P_C] );
!
pTiller->MoveTo( pos().x + itemoffsets[shortboatdir][TILLER][X],
pos().y + itemoffsets[shortboatdir][TILLER][Y],
pTiller->pos().z );
pTiller->setId( itemids[shortboatdir][TILLER_ID] );
!
pHold->MoveTo( pos().x + itemoffsets[shortboatdir][HOLD][X],
pos().y + itemoffsets[shortboatdir][HOLD][Y],
***************
*** 656,670 ****
if( pTiller == NULL )
return false;
!
P_ITEM pPortplank = FindItemBySerial( this->itemserials[ PORT_PLANK ] );
! if( pPortplank == NULL )
return false;
P_ITEM pStarplank = FindItemBySerial( this->itemserials[ STARB_PLANK ] );
! if( pStarplank == NULL )
return false;
P_ITEM pHold = FindItemBySerial( this->itemserials[ HOLD ] );
! if( pHold == NULL )
return false;
--- 656,670 ----
if( pTiller == NULL )
return false;
!
P_ITEM pPortplank = FindItemBySerial( this->itemserials[ PORT_PLANK ] );
! if( pPortplank == NULL )
return false;
P_ITEM pStarplank = FindItemBySerial( this->itemserials[ STARB_PLANK ] );
! if( pStarplank == NULL )
return false;
P_ITEM pHold = FindItemBySerial( this->itemserials[ HOLD ] );
! if( pHold == NULL )
return false;
***************
*** 673,677 ****
switch( this->boatdir )
{
! case 0:
dx += shift_;
dy -= moves_;
--- 673,677 ----
switch( this->boatdir )
{
! case 0:
dx += shift_;
dy -= moves_;
***************
*** 681,689 ****
dy += shift_;
break;
! case 4:
dx -= shift_;
dy += moves_;
break;
! case 6:
dx -= moves_;
dy -= shift_;
--- 681,689 ----
dy += shift_;
break;
! case 4:
dx -= shift_;
dy += moves_;
break;
! case 6:
dx -= moves_;
dy -= shift_;
***************
*** 716,723 ****
uoPacket.pause();
RegionIterator4Chars ri( pos() );
! for( ri.Begin(); !ri.atEnd(); ri++ )
{
P_PLAYER pc = dynamic_cast<P_PLAYER>(ri.GetData());
! if( pc )
{
cUOSocket* socket = pc->socket();
--- 716,723 ----
uoPacket.pause();
RegionIterator4Chars ri( pos() );
! for( ri.Begin(); !ri.atEnd(); ri++ )
{
P_PLAYER pc = dynamic_cast<P_PLAYER>(ri.GetData());
! if( pc )
{
cUOSocket* socket = pc->socket();
***************
*** 879,883 ****
UI16 x, y;
SI08 z;
! switch( this->boatdir )
{
case 0:
--- 879,883 ----
UI16 x, y;
SI08 z;
! switch( this->boatdir )
{
case 0:
***************
*** 894,898 ****
return;
}
!
z = pos().z + 3;
pc_currchar->MoveTo( x, y, z );
--- 894,898 ----
return;
}
!
z = pos().z + 3;
pc_currchar->MoveTo( x, y, z );
***************
*** 903,911 ****
else
{
! if( leave( socket, pplank ) )
{
socket->sysMessage( tr("You left the boat.") );
! }
! else
{
socket->sysMessage( tr("You cannot get off here!") );
--- 903,911 ----
else
{
! if( leave( socket, pplank ) )
{
socket->sysMessage( tr("You left the boat.") );
! }
! else
{
socket->sysMessage( tr("You cannot get off here!") );
***************
*** 921,925 ****
UI16 x, y, x0, y0, x1, y1;
! switch( this->boatdir )
{
case 0:
--- 921,925 ----
UI16 x, y, x0, y0, x1, y1;
! switch( this->boatdir )
{
case 0:
***************
*** 941,945 ****
}
UI16 tmp;
! if (x0 > x1)
{
tmp = x0;
--- 941,945 ----
}
UI16 tmp;
! if (x0 > x1)
{
tmp = x0;
***************
*** 947,951 ****
x1 = tmp;
}
! if (y0 > y1)
{
tmp = y0;
--- 947,951 ----
x1 = tmp;
}
! if (y0 > y1)
{
tmp = y0;
***************
*** 955,971 ****
signed char sz, mz, z;
bool check = false;
! for( x = x0; x <= x1; x++ )
{
! for( y = y0; y <= y1; y++)
{
sz = Map->staticTop( Coord_cl( x, y, 0, 0) );
mz = Map->mapElevation( Coord_cl( x, y, 0, 0) );
! if( (sz == ILLEGAL_Z) && (mz != -5) )
{
z = mz;
check = true;
break;
! }
! else if( (sz != ILLEGAL_Z) && (sz != -5) )
{
z = sz;
--- 955,971 ----
signed char sz, mz, z;
bool check = false;
! for( x = x0; x <= x1; x++ )
{
! for( y = y0; y <= y1; y++)
{
sz = Map->staticTop( Coord_cl( x, y, 0, 0) );
mz = Map->mapElevation( Coord_cl( x, y, 0, 0) );
! if( (sz == ILLEGAL_Z) && (mz != -5) )
{
z = mz;
check = true;
break;
! }
! else if( (sz != ILLEGAL_Z) && (sz != -5) )
{
z = sz;
***************
*** 975,984 ****
}
! if( check )
break;
}
! if( !check )
return false;
--- 975,984 ----
}
! if( check )
break;
}
! if( !check )
return false;
***************
*** 1009,1019 ****
UI08 shortboatdir = this->boatdir / 2;
if( pplank->id() == this->itemids[ shortboatdir ][PORT_P_C] )
! pplank->setId( this->itemids[ shortboatdir ][PORT_P_O] );
else if( pplank->id() == this->itemids[ shortboatdir ][PORT_P_O] )
! pplank->setId( this->itemids[ shortboatdir ][PORT_P_C] );
else if( pplank->id() == this->itemids[ shortboatdir ][STAR_P_C] )
! pplank->setId( this->itemids[ shortboatdir ][STAR_P_O] );
else if( pplank->id() == this->itemids[ shortboatdir ][STAR_P_O] )
! pplank->setId( this->itemids[ shortboatdir ][STAR_P_C] );
}
--- 1009,1019 ----
UI08 shortboatdir = this->boatdir / 2;
if( pplank->id() == this->itemids[ shortboatdir ][PORT_P_C] )
! pplank->setId( this->itemids[ shortboatdir ][PORT_P_O] );
else if( pplank->id() == this->itemids[ shortboatdir ][PORT_P_O] )
! pplank->setId( this->itemids[ shortboatdir ][PORT_P_C] );
else if( pplank->id() == this->itemids[ shortboatdir ][STAR_P_C] )
! pplank->setId( this->itemids[ shortboatdir ][STAR_P_O] );
else if( pplank->id() == this->itemids[ shortboatdir ][STAR_P_O] )
! pplank->setId( this->itemids[ shortboatdir ][STAR_P_C] );
}
***************
*** 1022,1026 ****
SERIAL serial;
! if( !socket || !socket->player() )
return 0;
--- 1022,1026 ----
SERIAL serial;
! if( !socket || !socket->player() )
return 0;
***************
*** 1029,1036 ****
//get the tiller man's item #
serial = this->itemserials[ TILLER ];
! if ( serial == INVALID_SERIAL )
return 0;
P_ITEM tiller = FindItemBySerial( serial );
! if ( tiller == NULL )
return 0;
--- 1029,1036 ----
//get the tiller man's item #
serial = this->itemserials[ TILLER ];
! if ( serial == INVALID_SERIAL )
return 0;
P_ITEM tiller = FindItemBySerial( serial );
! if ( tiller == NULL )
return 0;
***************
*** 1130,1141 ****
// khpae - make deed from a boat
! void cBoat::toDeed( cUOSocket* socket )
{
P_PLAYER pc = socket->player();
! if ( !pc )
return;
// if player is in boat
! if ( inMulti( pc->pos() ) )
{
socket->sysMessage ( tr("You must leave the boat to do this.") );
--- 1130,1141 ----
// khpae - make deed from a boat
! void cBoat::toDeed( cUOSocket* socket )
{
P_PLAYER pc = socket->player();
! if ( !pc )
return;
// if player is in boat
! if ( inMulti( pc->pos() ) )
{
socket->sysMessage ( tr("You must leave the boat to do this.") );
***************
*** 1145,1149 ****
// check if the player has the boat key
! if ( !authorized( pc ) )
{
socket->sysMessage ( tr("You are not allowed to do this!") );
--- 1145,1149 ----
// check if the player has the boat key
! if ( !authorized( pc ) )
{
socket->sysMessage ( tr("You are not allowed to do this!") );
***************
*** 1151,1155 ****
}
! if( items_.size() > 0 || chars_.size() > 0 )
{
socket->sysMessage ( tr("The boat is not empty.") );
--- 1151,1155 ----
}
! if( items_.size() > 0 || chars_.size() > 0 )
{
socket->sysMessage ( tr("The boat is not empty.") );
***************
*** 1163,1167 ****
P_ITEM pDeed = cItem::createFromScript( this->deedsection_ );
! if( !pDeed )
socket->sysMessage ( tr("An error occured. Send a bug report to the staff, please.") );
else
--- 1163,1167 ----
P_ITEM pDeed = cItem::createFromScript( this->deedsection_ );
! if( !pDeed )
socket->sysMessage ( tr("An error occured. Send a bug report to the staff, please.") );
else
***************
*** 1174,1188 ****
if( pTiller != NULL )
pTiller->remove();
!
P_ITEM pPortplank = FindItemBySerial( this->itemserials[ PORT_PLANK ] );
! if( pPortplank != NULL )
pPortplank->remove();
P_ITEM pStarplank = FindItemBySerial( this->itemserials[ STARB_PLANK ] );
! if( pStarplank != NULL )
pStarplank->remove();
P_ITEM pHold = FindItemBySerial( this->itemserials[ HOLD ] );
! if( pHold != NULL )
pHold->remove();
--- 1174,1188 ----
if( pTiller != NULL )
pTiller->remove();
!
P_ITEM pPortplank = FindItemBySerial( this->itemserials[ PORT_PLANK ] );
! if( pPortplank != NULL )
pPortplank->remove();
P_ITEM pStarplank = FindItemBySerial( this->itemserials[ STARB_PLANK ] );
! if( pStarplank != NULL )
pStarplank->remove();
P_ITEM pHold = FindItemBySerial( this->itemserials[ HOLD ] );
! if( pHold != NULL )
pHold->remove();
***************
*** 1201,1205 ****
QStringList fields, tables, conditions;
buildSqlString( fields, tables, conditions ); // Build our SQL string
! QString sqlString = QString( "SELECT %1 FROM uobjectmap,%2 WHERE uobjectmap.type = 'cBoat' AND %3" ).arg( fields.join( "," ) ).arg( tables.join( "," ) ).arg( conditions.join( " AND " ) );
UObjectFactory::instance()->registerType("cBoat", productCreator);
UObjectFactory::instance()->registerSqlQuery( "cBoat", sqlString );
--- 1201,1205 ----
QStringList fields, tables, conditions;
buildSqlString( fields, tables, conditions ); // Build our SQL string
! QString sqlString = QString( "SELECT %1 FROM `uobjectmap`,%2 WHERE uobjectmap.type = 'cBoat' AND %3" ).arg( fields.join( "," ) ).arg( tables.join( "," ) ).arg( conditions.join( " AND " ) );
UObjectFactory::instance()->registerType("cBoat", productCreator);
UObjectFactory::instance()->registerSqlQuery( "cBoat", sqlString );
***************
*** 1217,1221 ****
{
cMulti::load( result, offset );
!
autosail_ = atoi( result[offset++] );
boatdir = atoi( result[offset++] );
--- 1217,1221 ----
{
cMulti::load( result, offset );
!
autosail_ = atoi( result[offset++] );
boatdir = atoi( result[offset++] );
***************
*** 1229,1233 ****
// Load the other tables
! QString sql = "SELECT boats_itemids.a,boats_itemids.b,boats_itemids.id FROM boats_itemids WHERE serial = '" + QString::number( serial() ) + "'";
cDBResult res = persistentBroker->query( sql );
--- 1229,1233 ----
// Load the other tables
! QString sql = "SELECT `a`,`b`,`id` FROM `boats_itemids` WHERE `serial` = '" + QString::number( serial() ) + "'";
cDBResult res = persistentBroker->query( sql );
***************
*** 1253,1260 ****
res.free();
! sql = "SELECT boats_itemoffsets.a,boats_itemoffsets.b,boats_itemoffsets.c,boats_itemoffsets.offset FROM boats_itemoffsets WHERE serial = '" + QString::number( serial() ) + "'";
res = persistentBroker->query( sql );
! // Error Checking
if( !res.isValid() )
throw persistentBroker->lastError();
--- 1253,1260 ----
res.free();
! sql = "SELECT `a`,`b`,`c`,`offset` FROM `boats_itemoffsets` WHERE `serial` = '" + QString::number( serial() ) + "'";
res = persistentBroker->query( sql );
! // Error Checking
if( !res.isValid() )
throw persistentBroker->lastError();
***************
*** 1303,1307 ****
saveFields;
! // Save the other tables as well
for( i = 0; i < 4; i ++ )
{
--- 1303,1307 ----
saveFields;
! // Save the other tables as well
for( i = 0; i < 4; i ++ )
{
***************
*** 1347,1353 ****
return false;
! persistentBroker->addToDeleteQueue( "boats", QString( "serial = '%1'" ).arg( serial() ) );
! persistentBroker->addToDeleteQueue( "boats_itemoffsets", QString( "serial = '%1'" ).arg( serial() ) );
! persistentBroker->addToDeleteQueue( "boats_itemids", QString( "serial = '%1'" ).arg( serial() ) );
return cMulti::del();
--- 1347,1353 ----
return false;
! persistentBroker->addToDeleteQueue( "boats", QString( "`serial` = '%1'" ).arg( serial() ) );
! persistentBroker->addToDeleteQueue( "boats_itemoffsets", QString( "`serial` = '%1'" ).arg( serial() ) );
! persistentBroker->addToDeleteQueue( "boats_itemids", QString( "`serial` = '%1'" ).arg( serial() ) );
return cMulti::del();
Index: corpse.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/corpse.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** corpse.cpp 14 Sep 2003 16:31:48 -0000 1.37
--- corpse.cpp 30 Jan 2004 20:29:27 -0000 1.38
***************
*** 56,60 ****
QStringList fields, tables, conditions;
buildSqlString( fields, tables, conditions ); // Build our SQL string
! QString sqlString = QString( "SELECT %1 FROM uobjectmap,%2 WHERE uobjectmap.type = 'cCorpse' AND %3" ).arg( fields.join( "," ) ).arg( tables.join( "," ) ).arg( conditions.join( " AND " ) );
UObjectFactory::instance()->registerType("cCorpse", productCreator);
UObjectFactory::instance()->registerSqlQuery( "cCorpse", sqlString );
--- 56,60 ----
QStringList fields, tables, conditions;
buildSqlString( fields, tables, conditions ); // Build our SQL string
! QString sqlString = QString( "SELECT %1 FROM `uobjectmap`,%2 WHERE uobjectmap.type = 'cCorpse' AND %3" ).arg( fields.join( "," ) ).arg( tables.join( "," ) ).arg( conditions.join( " AND " ) );
UObjectFactory::instance()->registerType("cCorpse", productCreator);
UObjectFactory::instance()->registerSqlQuery( "cCorpse", sqlString );
***************
*** 79,84 ****
// Get the corpse equipment
! QString sql = "SELECT corpses_equipment.layer,corpses_equipment.item FROM corpses_equipment WHERE serial = '" + QString::number( serial() ) + "'";
!
cDBResult res = persistentBroker->query( sql );
--- 79,84 ----
// Get the corpse equipment
! QString sql = "SELECT `serial`,`layer`,`item` FROM `corpses_equipment` WHERE `serial` = '" + QString::number( serial() ) + "'";
!
cDBResult res = persistentBroker->query( sql );
***************
*** 97,101 ****
initSave;
setTable( "corpses" );
!
addField( "serial", serial() );
addField( "bodyid", bodyId_ );
--- 97,101 ----
initSave;
setTable( "corpses" );
!
addField( "serial", serial() );
addField( "bodyid", bodyId_ );
***************
*** 111,119 ****
if( isPersistent )
{
! persistentBroker->executeQuery( QString( "DELETE FROM corpses_equipment WHERE serial = '%1'" ).arg( serial() ) );
}
for( map< UINT8, SERIAL >::iterator it = equipment_.begin(); it != equipment_.end(); ++it )
! persistentBroker->executeQuery( QString( "REPLACE INTO corpses_equipment VALUES(%1,%2,%3)" ).arg( serial() ).arg( it->first ).arg( it->second ) );
cItem::save();
--- 111,119 ----
if( isPersistent )
{
! persistentBroker->executeQuery( QString( "DELETE FROM `corpses_equipment` WHERE `serial` = '%1'" ).arg( serial() ) );
}
for( map< UINT8, SERIAL >::iterator it = equipment_.begin(); it != equipment_.end(); ++it )
! persistentBroker->executeQuery( QString( "REPLACE INTO `corpses_equipment` VALUES(%1,%2,%3)" ).arg( serial() ).arg( it->first ).arg( it->second ) );
cItem::save();
***************
*** 125,130 ****
return false;
! persistentBroker->addToDeleteQueue( "corpses", QString( "serial = '%1'" ).arg( serial() ) );
! persistentBroker->addToDeleteQueue( "corpses_equipment", QString( "serial = '%1'" ).arg( serial() ) );
return cItem::del();
--- 125,130 ----
return false;
! persistentBroker->addToDeleteQueue( "corpses", QString( "`serial` = '%1'" ).arg( serial() ) );
! persistentBroker->addToDeleteQueue( "corpses_equipment", QString( "`serial` = '%1'" ).arg( serial() ) );
return cItem::del();
***************
*** 155,159 ****
corpseEquip.setSerial( serial() );
!
for( map< UINT8, SERIAL >::iterator it = equipment_.begin(); it != equipment_.end(); ++it )
{
--- 155,159 ----
corpseEquip.setSerial( serial() );
!
for( map< UINT8, SERIAL >::iterator it = equipment_.begin(); it != equipment_.end(); ++it )
{
***************
*** 205,209 ****
mSock->send( &sendItem );
mSock->send( &corpseEquip );
! mSock->send( &corpseContent );
}
}
--- 205,209 ----
mSock->send( &sendItem );
mSock->send( &corpseEquip );
! mSock->send( &corpseContent );
}
}
Index: house.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/house.cpp,v
retrieving revision 1.119
retrieving revision 1.120
diff -C2 -d -r1.119 -r1.120
*** house.cpp 22 Dec 2003 12:11:35 -0000 1.119
--- house.cpp 30 Jan 2004 20:29:27 -0000 1.120
***************
*** 64,68 ****
{
nItem = cItem::createFromScript( id );
! }
if( nItem )
--- 64,68 ----
{
nItem = cItem::createFromScript( id );
! }
if( nItem )
***************
*** 81,85 ****
{
const cElement *childTag = Tag->getChild( i );
!
QString TagName = childTag->name();
QString Value = childTag->getValue();
--- 81,85 ----
{
const cElement *childTag = Tag->getChild( i );
!
QString TagName = childTag->name();
QString Value = childTag->getValue();
***************
*** 147,151 ****
if( mapTile.flag1 & 0x40 || mapTile.flag1 & 0x80 )
return false;
!
StaticsIterator msi = Map->staticsIterator( multipos );
while( !msi.atEnd() )
--- 147,151 ----
if( mapTile.flag1 & 0x40 || mapTile.flag1 & 0x80 )
return false;
!
StaticsIterator msi = Map->staticsIterator( multipos );
while( !msi.atEnd() )
***************
*** 156,162 ****
++msi;
}
!
RegionIterator4Items ri( multipos );
! for( ri.Begin(); !ri.atEnd(); ri++ )
{
P_ITEM pi = ri.GetData();
--- 156,162 ----
++msi;
}
!
RegionIterator4Items ri( multipos );
! for( ri.Begin(); !ri.atEnd(); ri++ )
{
P_ITEM pi = ri.GetData();
***************
*** 242,246 ****
si->update();
}
!
pc_currchar->MoveTo( this->pos().x + charpos_.x, this->pos().y + charpos_.y, this->pos().z + charpos_.z );
pc_currchar->resend();
--- 242,246 ----
si->update();
}
!
pc_currchar->MoveTo( this->pos().x + charpos_.x, this->pos().y + charpos_.y, this->pos().z + charpos_.z );
pc_currchar->resend();
***************
*** 298,302 ****
this->remove();
!
if( this->deedsection_.isNull() || this->deedsection_.isEmpty() || !pBackpack )
{
--- 298,302 ----
this->remove();
!
if( this->deedsection_.isNull() || this->deedsection_.isEmpty() || !pBackpack )
{
***************
*** 306,310 ****
P_ITEM pDeed = cItem::createFromScript( this->deedsection_ );
! if( pDeed )
{
pBackpack->addItem( pDeed );
--- 306,310 ----
P_ITEM pDeed = cItem::createFromScript( this->deedsection_ );
! if( pDeed )
{
pBackpack->addItem( pDeed );
***************
*** 336,340 ****
initSave;
setTable( "houses" );
!
addField( "serial", serial() );
addField( "nokey", nokey_ );
--- 336,340 ----
initSave;
setTable( "houses" );
!
addField( "serial", serial() );
addField( "nokey", nokey_ );
***************
*** 354,358 ****
return false;
! persistentBroker->addToDeleteQueue( "houses", QString( "serial = '%1'" ).arg( serial() ) );
return cMulti::del();
--- 354,358 ----
return false;
! persistentBroker->addToDeleteQueue( "houses", QString( "`serial` = '%1'" ).arg( serial() ) );
return cMulti::del();
***************
*** 368,372 ****
QStringList fields, tables, conditions;
buildSqlString( fields, tables, conditions ); // Build our SQL string
! QString sqlString = QString( "SELECT %1 FROM uobjectmap,%2 WHERE uobjectmap.type = 'cHouse' AND %3" ).arg( fields.join( "," ) ).arg( tables.join( "," ) ).arg( conditions.join( " AND " ) );
UObjectFactory::instance()->registerType("cHouse", productCreator);
UObjectFactory::instance()->registerSqlQuery( "cHouse", sqlString );
--- 368,372 ----
QStringList fields, tables, conditions;
buildSqlString( fields, tables, conditions ); // Build our SQL string
! QString sqlString = QString( "SELECT %1 FROM `uobjectmap`,%2 WHERE uobjectmap.type = 'cHouse' AND %3" ).arg( fields.join( "," ) ).arg( tables.join( "," ) ).arg( conditions.join( " AND " ) );
UObjectFactory::instance()->registerType("cHouse", productCreator);
UObjectFactory::instance()->registerSqlQuery( "cHouse", sqlString );
***************
*** 384,393 ****
cUOTxCustomHouse customhouse;
customhouse.setSerial( this->serial() );
! customhouse.setCompression( 0 );
customhouse.setRevision( this->revision() );
for( UINT32 i = 0; i < chtiles_.count(); i++ )
customhouse.addTile( chtiles_[i].model(), chtiles_[i].pos() );
!
socket->send( &deed );
socket->send( &customhouse );
--- 384,393 ----
cUOTxCustomHouse customhouse;
customhouse.setSerial( this->serial() );
! customhouse.setCompression( 0 );
customhouse.setRevision( this->revision() );
for( UINT32 i = 0; i < chtiles_.count(); i++ )
customhouse.addTile( chtiles_[i].model(), chtiles_[i].pos() );
!
socket->send( &deed );
socket->send( &customhouse );
Index: items.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/items.cpp,v
retrieving revision 1.366
retrieving revision 1.367
diff -C2 -d -r1.366 -r1.367
*** items.cpp 29 Jan 2004 23:56:32 -0000 1.366
--- items.cpp 30 Jan 2004 20:29:28 -0000 1.367
***************
*** 93,97 ****
cItemBase *itembase = new cItemBase;
itembase->id_ = id;
!
itembases.insert( id, itembase );
}
--- 93,97 ----
cItemBase *itembase = new cItemBase;
itembase->id_ = id;
!
itembases.insert( id, itembase );
[...1025 lines suppressed...]
else if( name == "corpse" )
--- 2211,2215 ----
else if( name == "dye" )
{
! setDye( value.toInt() != 0 ? true : false );
}
else if( name == "corpse" )
***************
*** 2243,2247 ****
else GET_PROPERTY( "owner", owner() )
else GET_PROPERTY( "totalweight", totalweight_ )
!
// container
else if( name == "container" )
--- 2243,2247 ----
else GET_PROPERTY( "owner", owner() )
else GET_PROPERTY( "totalweight", totalweight_ )
!
// container
else if( name == "container" )
Index: multis.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/multis.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** multis.cpp 8 Jan 2004 23:43:57 -0000 1.36
--- multis.cpp 30 Jan 2004 20:29:30 -0000 1.37
***************
*** 51,55 ****
#undef DBGFILE
! #define DBGFILE "multis.cpp"
cMulti::cMulti()
--- 51,55 ----
#undef DBGFILE
! #define DBGFILE "multis.cpp"
cMulti::cMulti()
***************
*** 72,83 ****
{
cItem::load( result, offset );
!
coowner_ = atoi( result[offset++] );
deedsection_ = result[offset++];
// Load from two additional tables here
! QString sql = "SELECT multis_bans.serial,multis_bans.ban FROM multis_bans WHERE multis_bans.serial = '" + QString::number( serial() ) + "'";
! cDBResult res = persistentBroker->query( sql );
while( res.fetchrow() )
--- 72,83 ----
{
cItem::load( result, offset );
!
coowner_ = atoi( result[offset++] );
deedsection_ = result[offset++];
// Load from two additional tables here
! QString sql = "SELECT `serial`,`ban` FROM `multis_bans` WHERE `serial` = '" + QString::number( serial() ) + "'";
! cDBResult res = persistentBroker->query( sql );
while( res.fetchrow() )
***************
*** 93,97 ****
res.free();
! sql = "SELECT multis_friends.serial,multis_friends.friend FROM multis_friends WHERE multis_friends.serial = '" + QString::number( serial() ) + "'";
res = persistentBroker->query( sql );
--- 93,97 ----
res.free();
! sql = "SELECT `serial`,`friend` FROM `multis_friends` WHERE `serial` = '" + QString::number( serial() ) + "'";
res = persistentBroker->query( sql );
***************
*** 114,118 ****
initSave;
setTable( "multis" );
!
addField( "serial", serial() );
addField( "coowner", coowner_ );
--- 114,118 ----
initSave;
setTable( "multis" );
!
addField( "serial", serial() );
addField( "coowner", coowner_ );
***************
*** 125,139 ****
if( isPersistent )
{
! persistentBroker->executeQuery( QString( "DELETE FROM multis_bans WHERE serial = '%1'" ).arg( serial() ) );
! persistentBroker->executeQuery( QString( "DELETE FROM multis_friends WHERE serial = '%1'" ).arg( serial() ) );
}
!
// Friends + Bans
INT32 i;
for ( i = 0; i < bans_.size(); ++i )
! persistentBroker->executeQuery( QString( "REPLACE INTO multis_bans VALUES(%1,%2)" ).arg( serial() ).arg( bans_[i] ) );
for ( i = 0; i < friends_.size(); ++i )
! persistentBroker->executeQuery( QString( "REPLACE INTO multis_friends VALUES(%1,%2)" ).arg( serial() ).arg( friends_[i] ) );
cItem::save();
--- 125,139 ----
if( isPersistent )
{
! persistentBroker->executeQuery( QString( "DELETE FROM `multis_bans` WHERE `serial` = '%1'" ).arg( serial() ) );
! persistentBroker->executeQuery( QString( "DELETE FROM `multis_friends` WHERE `serial` = '%1'" ).arg( serial() ) );
}
!
// Friends + Bans
INT32 i;
for ( i = 0; i < bans_.size(); ++i )
! persistentBroker->executeQuery( QString( "REPLACE INTO `multis_bans` VALUES(%1,%2)" ).arg( serial() ).arg( bans_[i] ) );
for ( i = 0; i < friends_.size(); ++i )
! persistentBroker->executeQuery( QString( "REPLACE INTO `multis_friends` VALUES(%1,%2)" ).arg( serial() ).arg( friends_[i] ) );
cItem::save();
***************
*** 145,151 ****
return false;
! persistentBroker->addToDeleteQueue( "multis", QString( "serial = '%1'" ).arg( serial() ) );
! persistentBroker->addToDeleteQueue( "multis_bans", QString( "serial = '%1'" ).arg( serial() ) );
! persistentBroker->add...
[truncated message content] |