/*---------------------------------------------------------------------------*/
/* AIFunct.c : */
/* author : Olivier Didelot.*/
/* date   : 30/01/1997*/
/*---------------------------------------------------------------------------*/
 
#include "AIUseCPA.h"
#include "specif/AIOption.h"
 
#include "AI_Struc.h"
#include "AI_Funct.h"
 
char* AI_fn_pszGetActorName (HIE_tdxHandleToSuperObject hSupObj)
{
	AI_tdxHandleToMind hMind;
 
	if (!M_GetMSHandle((hSupObj), Brain)) return NULL;
 
	hMind = AI_M_stGetMindOfSuperObj (hSupObj);
	if (!hMind) return NULL;
 
	return AI_M_szGetPersoName(hMind);
}
 
 
char* AI_fn_pszGetFamilyName (HIE_tdxHandleToSuperObject hSupObj, char* szBuffer)
{
	MS_tdxHandleTo3dData h_3dData;
	tdxHandleToState hInitialState;
	char cCar;
	long lCounter;
 
	h_3dData = M_GetMSHandle(hSupObj,3dData);
	if (!h_3dData) return NULL;
 
	hInitialState = fn_h3dDataGetInitialState (h_3dData);
	if (!hInitialState) return NULL;
	
	strcpy ( szBuffer, fn_p_szGetStateName(hInitialState) );
 
	for (lCounter=0 ;; lCounter++)
	{
		cCar = szBuffer[lCounter];
		
		if (cCar==0) return NULL;
		
		if (cCar==' ')
		{
			szBuffer[lCounter]=0;
			return szBuffer;
		}
	}
 
	return NULL;
}
