BOOL CMapClass::IsChildOf(CMapClass *pObject)
{
	CMapClass *pParent = Parent;

	while(1)
	{
		if(pParent == pObject)
			return TRUE;
		if(pParent->IsWorldObject())
			break;	// world object, not parent .. return false.
		pParent = pParent->Parent;
	}

	return FALSE;
}
//-----------------------------------------------------------------------------
// Purpose: Returns the world object that the given object belongs to.
// Input  : pStart - Object to traverse up from to find the world object.
//-----------------------------------------------------------------------------
CMapWorld *CMapClass::GetWorldObject(CMapClass *pStart)
{
	CMapClass *pobj = pStart;

	while (pobj != NULL)
	{
		if (pobj->IsWorldObject())
		{
			return((CMapWorld *)pobj);
		}
		pobj = pobj->Parent;
	}

	// has no world:
	return NULL;
}