Ejemplo n.º 1
0
//-----------------------------------------------------------------------------
// Purpose: Passes Touch along to certain named doors.
//-----------------------------------------------------------------------------
void CBaseDoor::ChainTouch( CBaseEntity *pOther )
{
	if ( m_isChaining )
		return;

	CBaseEntity *ent = NULL;
	while ( ( ent = gEntList.FindEntityByName( ent, m_ChainTarget, NULL ) ) != NULL )
	{
		if ( ent == this )
			continue;

		CBaseDoor *door = dynamic_cast< CBaseDoor * >( ent );
		if ( door )
		{
			door->SetChaining( true );
			door->Touch( pOther );
			door->SetChaining( false );
		}
	}
}
Ejemplo n.º 2
0
void CBaseDoor :: ChainTouch( CBaseEntity *pOther )
{
	// to prevent recursion
	if( m_isChaining ) return;

	CBaseEntity *pEnt = NULL;

	while(( pEnt = UTIL_FindEntityByTargetname( pEnt, STRING( m_iChainTarget ))) != NULL )
	{
		if( pEnt == this ) continue;

		CBaseDoor *pDoor = (CBaseDoor *)pEnt;

		if( pDoor )
		{
			pDoor->SetChaining( true );
			pDoor->Touch( pOther );
			pDoor->SetChaining( false );
		}
	}
}