src/softbody2/Objects/DRGShader.cpp
HRESULT	CDRGShader::CheckAgainstChildren(CDRGShader	*pPotentialParent, CDRGShader *pPotentialChild)
{
	CDRGShader	*pTempShader = pPotentialChild;

	//skip to end of list, comparing against parent Shader
	while (pTempShader != NULL)
	{
		if(pPotentialChild == pPotentialParent)
			return E_FAIL;

		pTempShader = pTempShader->m_pNext;
	}

	//if we got here, none of the children was the potential parent, no circular list
	if (pPotentialChild->m_pNext == NULL)
		return S_OK;
	else
		return CheckAgainstChildren(pPotentialParent, pPotentialChild->m_pNext);
}
// -----------------------------------------------------------------------
// HRESULT CDRGObject::CheckAgainstChildren(CDRGObject	*pPotentialParent, 
//											CDRGObject *pPotentialChild)
//
//  Checks to make sure the object you want to make a parent of another, 
// isn't already one of that objects children. Thou shalt not murder the stack!
// -----------------------------------------------------------------------


Checks to make sure the object you want to make a parent of another,
isn't already one of that objects children. Thou shalt not murder the stack!
Checks to make sure the object you want to make a parent of another isn ' t already one of that objects children . Thou shalt not murder the stack!
HRESULT	CDRGShader::CheckAgainstChildren(CDRGShader	*pPotentialParent, CDRGShader *pPotentialChild)
{
	CDRGShader	*pTempShader = pPotentialChild;
	while (pTempShader != NULL)
	{
		if(pPotentialChild == pPotentialParent)
			return E_FAIL;
		pTempShader = pTempShader->m_pNext;
	}
	if (pPotentialChild->m_pNext == NULL)
		return S_OK;
	else
		return CheckAgainstChildren(pPotentialParent, pPotentialChild->m_pNext);
}
HRESULT CDRGShader :: CheckAgainstChildren ( CDRGShader * pPotentialParent , CDRGShader * pPotentialChild ) { CDRGShader * pTempShader = pPotentialChild ; while ( pTempShader != NULL ) { if ( pPotentialChild == pPotentialParent ) return E_FAIL ; pTempShader = pTempShader -> m_pNext ; } if ( pPotentialChild -> m_pNext == NULL ) return S_OK ; else return CheckAgainstChildren ( pPotentialParent , pPotentialChild -> m_pNext ) ; }
HRESULT CDRGObject::CheckAgainstChildren(CDRGObject    *pPotentialParent,
CDRGObject *pPotentialChild)
HRESULT CDRGObject :: CheckAgainstChildren ( CDRGObject * pPotentialParent CDRGObject * pPotentialChild )
//skip to end of list, comparing against parent Shader //if we got here, none of the children was the potential parent, no circular list