Getting the BodyPart count on an Object

	//someObject defined elsewhere
 
	int count = 0;
 
	orxBODY *someBody = orxOBJECT_GET_STRUCTURE(someObject , BODY);
 
	orxBODY_PART *part = orxBody_GetNextPart(someBody, orxNULL);
	while (part != orxNULL){
		orxBODY_PART *nextPart = orxBody_GetNextPart(someBody, part);
 
		if (orxString_Compare(orxBody_GetPartName(part), "SomeBodyPart") == 0) {
			count++;
		}			
		part = nextPart;
	}
 
	return count;