Update of /cvsroot/wpdev/wolfpack/ai
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28950/ai
Modified Files:
ai_humans.cpp
Log Message:
Container content changes
Index: ai_humans.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ai/ai_humans.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** ai_humans.cpp 27 Oct 2004 14:06:54 -0000 1.27
--- ai_humans.cpp 2 Nov 2004 20:45:40 -0000 1.28
***************
*** 113,156 ****
P_ITEM pPack = m_npc->getBankbox();
! cItem::ContainerContent stableitems;
if ( pPack )
! {
! cItem::ContainerContent content = pPack->content();
! cItem::ContainerContent::const_iterator it( content.begin() );
! while ( it != content.end() )
! {
if ( !( *it )->hasTag( "player" ) || !( *it )->hasTag( "pet" ) )
continue;
if ( ( *it ) && ( uint )( *it )->getTag( "player" ).toInt() == pTalker->serial() )
! stableitems.push_back( ( *it ) );
! ++it;
}
}
! if ( !stableitems.empty() )
{
! cItem::ContainerContent::const_iterator it( stableitems.begin() );
! while ( it != stableitems.end() )
! {
! if ( ( *it ) )
! {
! P_NPC pPet = dynamic_cast<P_NPC>( World::instance()->findChar( ( *it )->getTag( "pet" ).toInt() ) );
! if ( pPet )
! {
! if (pTalker->pets().count() + pPet->controlSlots() > pTalker->maxControlSlots()) {
! m_npc->talk(1049612, pPet->name());
! } else {
! pPet->free = false;
! // we need this for db saves
! pPet->setStablemasterSerial( INVALID_SERIAL );
! pPet->setOwner( pTalker ); // This is important...
! pPet->moveTo( m_npc->pos() );
! pPet->resend();
! }
}
- ( *it )->remove();
}
! ++it;
}
--- 113,145 ----
P_ITEM pPack = m_npc->getBankbox();
! QPtrList<cItem> stableitems;
if ( pPack )
! {
! for (ContainerIterator it(pPack); !it.atEnd(); ++it) {
if ( !( *it )->hasTag( "player" ) || !( *it )->hasTag( "pet" ) )
continue;
if ( ( *it ) && ( uint )( *it )->getTag( "player" ).toInt() == pTalker->serial() )
! stableitems.append( ( *it ) );
}
}
! if ( !stableitems.isEmpty() )
{
! for (P_ITEM pItem = stableitems.first(); pItem; pItem = stableitems.next()) {
! P_NPC pPet = dynamic_cast<P_NPC>( World::instance()->findChar( pItem->getTag( "pet" ).toInt() ) );
! if ( pPet ) {
! if (pTalker->pets().count() + pPet->controlSlots() > pTalker->maxControlSlots()) {
! m_npc->talk(1049612, pPet->name());
! } else {
! pPet->free = false;
! // we need this for db saves
! pPet->setStablemasterSerial( INVALID_SERIAL );
! pPet->setOwner( pTalker ); // This is important...
! pPet->moveTo( m_npc->pos() );
! pPet->resend();
}
}
! pItem->remove();
}
|