CBaseHandle CBaseEntityList::AddEntityAtSlot( IHandleEntity *pEnt, int iSlot, int iForcedSerialNum )
{
	// Init the CSerialEntity.
	CEntInfo *pSlot = &m_EntPtrArray[iSlot];
	Assert( pSlot->m_pEntity == NULL );
	pSlot->m_pEntity = pEnt;

	// Force the serial number (client-only)?
	if ( iForcedSerialNum != -1 )
	{
		pSlot->m_SerialNumber = iForcedSerialNum;
		
		#if !defined( CLIENT_DLL )
			// Only the client should force the serial numbers.
			Assert( false );
		#endif
	}
	
	// Update our list of active entities.
	m_activeList.AddToTail( pSlot );
	CBaseHandle retVal( iSlot, pSlot->m_SerialNumber );

	// Tell the entity to store its handle.
	pEnt->SetRefEHandle( retVal );

	// Notify any derived class.
	OnAddEntity( pEnt, retVal );
	return retVal;
}
예제 #2
0
CBaseHandle CBaseEntityList::AddEntityAtSlot( IHandleEntity *pEnt, int iSlot, int iForcedSerialNum )
{
	// Init the CSerialEntity.
	CEntInfo *pSlot = &m_EntPtrArray[iSlot];
    // this assert can be hit when creating entities within the creation of other entities
    // i.e. creating a grenade within sop_radio.
    // this is fine, just ignore it for now.
	//Assert( pSlot->m_pEntity == NULL );
	pSlot->m_pEntity = pEnt;

	// Force the serial number (client-only)?
	if ( iForcedSerialNum != -1 )
	{
		pSlot->m_SerialNumber = iForcedSerialNum;
		
		#if !defined( CLIENT_DLL )
			// Only the client should force the serial numbers.
			//Assert( false );
		#endif
	}
	
	// Update our list of active entities.
	m_activeList.AddToTail( pSlot );
	CBaseHandle retVal( iSlot, pSlot->m_SerialNumber );

	// Tell the entity to store its handle.
	//pEnt->SetRefEHandle( retVal );


	// Notify any derived class.
	OnAddEntity( pEnt, retVal );
	return retVal;
}