Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26314
Modified Files:
items.cpp wolfpack.cpp world.cpp
Log Message:
Fixed a postprocessing bug.
Index: items.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/items.cpp,v
retrieving revision 1.363
retrieving revision 1.364
diff -C2 -d -r1.363 -r1.364
*** items.cpp 8 Jan 2004 08:33:38 -0000 1.363
--- items.cpp 25 Jan 2004 18:48:15 -0000 1.364
***************
*** 1626,1644 ****
// This subtracts the weight of the top-container
// And then readds the new weight
! void cItem::setTotalweight( INT32 data )
{
//if( data < 0 )
// FixWeight!
!
! if ( container_ )
! {
! if( container_->isChar() )
{
P_CHAR pChar = dynamic_cast<P_CHAR>( container_ );
if( pChar && ( ( layer_ < 0x1A ) || ( layer_ == 0x1E ) ) )
pChar->setWeight( pChar->weight() - totalweight_ );
! }
! else if( container_->isItem() )
! {
P_ITEM pItem = dynamic_cast<P_ITEM>( container_ );
if( pItem )
--- 1626,1644 ----
// This subtracts the weight of the top-container
// And then readds the new weight
! void cItem::setTotalweight( int data )
{
//if( data < 0 )
// FixWeight!
!
! // Completely ignore the container if the free flag is set
! // this flag is abused during the load phase of the server
! // to flag items with yet unprocessed container values
! if (!free && container_) {
! if(container_->isChar())
{
P_CHAR pChar = dynamic_cast<P_CHAR>( container_ );
if( pChar && ( ( layer_ < 0x1A ) || ( layer_ == 0x1E ) ) )
pChar->setWeight( pChar->weight() - totalweight_ );
! } else if(container_->isItem()) {
P_ITEM pItem = dynamic_cast<P_ITEM>( container_ );
if( pItem )
***************
*** 1651,1667 ****
totalweight_ = data;
! if ( container_ )
! {
! if( container_->isChar() )
! {
P_CHAR pChar = dynamic_cast<P_CHAR>( container_ );
if( pChar && ( ( layer_ < 0x1A ) || ( layer_ == 0x1E ) ) )
pChar->setWeight( pChar->weight() + totalweight_ );
! }
! else if( container_->isItem() )
! {
P_ITEM pItem = dynamic_cast<P_ITEM>( container_ );
! if( pItem )
! pItem->setTotalweight( pItem->totalweight() + totalweight_ );
}
}
--- 1651,1667 ----
totalweight_ = data;
! // Completely ignore the container if the free flag is set
! // this flag is abused during the load phase of the server
! // to flag items with yet unprocessed container values
! if (!free && container_) {
! if (container_->isChar()) {
P_CHAR pChar = dynamic_cast<P_CHAR>( container_ );
if( pChar && ( ( layer_ < 0x1A ) || ( layer_ == 0x1E ) ) )
pChar->setWeight( pChar->weight() + totalweight_ );
! } else if (container_->isItem()) {
P_ITEM pItem = dynamic_cast<P_ITEM>( container_ );
! if(pItem) {
! pItem->setTotalweight( pItem->totalweight() + totalweight_);
! }
}
}
***************
*** 1828,1834 ****
SERIAL containerSerial = atoi( result[offset++] );
! if( containerSerial != INVALID_SERIAL ) // if it's invalid, we won't set.
container_ = reinterpret_cast<cUObject*>(containerSerial);
!
// ugly optimization ends here.
--- 1828,1836 ----
SERIAL containerSerial = atoi( result[offset++] );
! if (containerSerial != INVALID_SERIAL) {
container_ = reinterpret_cast<cUObject*>(containerSerial);
! free = true; // Abuse free for lingering items
! }
!
// ugly optimization ends here.
Index: wolfpack.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wolfpack.cpp,v
retrieving revision 1.480
retrieving revision 1.481
diff -C2 -d -r1.480 -r1.481
*** wolfpack.cpp 22 Jan 2004 04:48:12 -0000 1.480
--- wolfpack.cpp 25 Jan 2004 18:48:33 -0000 1.481
***************
*** 469,475 ****
--- 469,478 ----
}
+ #if !defined(_DEBUG)
try
{
+ #endif
World::instance()->load();
+ #if !defined(_DEBUG)
}
catch( QString &error )
***************
*** 483,486 ****
--- 486,490 ----
return 1;
}
+ #endif
Console::instance()->PrepareProgress( "Initializing Multis" );
Index: world.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/world.cpp,v
retrieving revision 1.52
retrieving revision 1.53
diff -C2 -d -r1.52 -r1.53
*** world.cpp 26 Nov 2003 03:53:53 -0000 1.52
--- world.cpp 25 Jan 2004 18:48:54 -0000 1.53
***************
*** 522,574 ****
SERIAL contserial = reinterpret_cast<SERIAL>(pi->container());
! // 1. Handle the Container Value
! if( isItemSerial( contserial ) )
! {
! P_ITEM pCont = FindItemBySerial( contserial );
!
! if( pCont )
! {
! pCont->addItem( pi, false, isCharSerial( reinterpret_cast<SERIAL>( pCont->container() ) )?false:true, true );
! }
! else
! {
! // Queue this item up for deletion
deleteItems.append( pi );
! continue; // Skip further processing
}
! }
! else if( isCharSerial( contserial ) )
! {
! P_CHAR pCont = FindCharBySerial( contserial );
! if( pCont )
! {
! // NoRemove is important.
! // It is faster *and* it prevents onEquip from being fired
! pCont->addItem( (cBaseChar::enLayer)pi->layer(), pi, true, true );
! }
! else
! {
! deleteItems.append( pi );
! continue; // Skip further processing
}
! }
! else // Add to Map Regions
! {
! int max_x = Map->mapTileWidth(pi->pos().map) * 8;
! int max_y = Map->mapTileHeight(pi->pos().map) * 8;
! if ( pi->pos().x > max_x || pi->pos().y > max_y )
! {
! // these are invalid locations, delete them!
! deleteItems.append( pi );
}
- else
- MapObjects::instance()->add(pi);
- // continue;
}
// If this item has a multiserial then add it to the multi
! if( isItemSerial( pi->multis() ) )
! {
cMulti *pMulti = dynamic_cast< cMulti* >( FindItemBySerial( pi->multis() ) );
--- 522,561 ----
SERIAL contserial = reinterpret_cast<SERIAL>(pi->container());
! // We used free for uncontained items
! if (!pi->free) {
! int max_x = Map->mapTileWidth(pi->pos().map) * 8;
! int max_y = Map->mapTileHeight(pi->pos().map) * 8;
! if (pi->pos().x > max_x || pi->pos().y > max_y) {
deleteItems.append( pi );
! continue;
! } else {
! MapObjects::instance()->add(pi);
}
! } else {
! // 1. Handle the Container Value
! if (isItemSerial(contserial)) {
! P_ITEM pCont = FindItemBySerial(contserial);
! if (pCont) {
! pCont->addItem(pi, false, true, true);
! } else {
! deleteItems.append(pi); // Queue this item up for deletion
! continue; // Skip further processing
! }
}
! else if (isCharSerial(contserial)) {
! P_CHAR pCont = FindCharBySerial( contserial );
!
! if (pCont) {
! pCont->addItem((cBaseChar::enLayer) pi->layer(), pi, true, true);
! } else {
! deleteItems.append(pi);
! continue;
! }
}
}
// If this item has a multiserial then add it to the multi
! if (isItemSerial(pi->multis())) {
cMulti *pMulti = dynamic_cast< cMulti* >( FindItemBySerial( pi->multis() ) );
|