// EdIRIAGl.cpp : implementation file
//

#include "stdafx.h"

#include "Defines.hpp"

#define D_ZdxStuff_StructureDefine

#ifdef D_ED_IR_ACTIVE

#include "EdIRIAGl.hpp"

#include "EdIRIAWd.hpp"

#include "ai_intf.hpp"

#include "x:\cpa\main\inc\_EditID.h"
#include "TLS/LPSconst.hpp" 

#include "ACP_base.h"
#include "incITF.h"
#define D_State_Define
#include "IncGAM.h"
#undef D_State_Define
#include "incAI.h"
#include "TFA.h"
#include "OAc/CPA_NLL.hpp"

//Stefan Dumitrean 18-05-98
#include "EdIRFrm.hpp"
#include "EdIRBels.hpp"
#include "EdIRIrd.hpp"
#include "EdIRMacL.hpp"
#include "EdIRBeen.hpp"
extern CPA_EdIR_MacroList	g_clMacroList;
//End Stefan Dumitrean


#define C_CHANNELTYPE			"Channel"
#define C_TEXTTYPE				"Text"
#define C_FONTTYPE				"Font"
#define C_SUPEROBJECTTYPE	"SuperObject"

//Stefan Dumitrean 26-05-98
#define C_szIAMacroTypeName                     "Macro"
#define C_szIASubroutineTypeName                "Subroutine"
//End Stefan Dumitrean


#ifdef D_GENERATE_KNOWNWORDS
/**********************************************************************************/
CString fn_csGetParamType(char cType)
{
	if(cType==C_LONG_PARAM[0] ||
		 cType==C_ADDR_LONG_PARAM[0])
		return "Constante";

	if(cType==C_REAL_PARAM[0] ||
		 cType==C_ADDR_REAL_PARAM[0])
		return "Reel";

	if(cType==C_PERSO_PARAM[0] ||
		 cType==C_ADDR_PERSO_PARAM[0])
		return "Perso";

	if(cType==C_ALWAYS_PARAM[0])
		return "Always";

	if(cType==C_PERSO_PARAM_ONLY[0])
		return "Perso (pas de dsg var)";

	if(cType==C_VECTOR_PARAM[0] ||
		 cType==C_ADDR_VECTOR_PARAM[0])
		return "Vecteur";

	if(cType==C_WAYPOINT_PARAM[0] ||
		 cType==C_ADDR_WAYPOINT_PARAM[0])
		return "WayPoint";

	if(cType==C_LIST_PARAM[0] ||
		 cType==C_ADDR_LIST_PARAM[0])
		return "Liste de persos";

	if(cType==C_BOOLEAN_PARAM[0] ||
		 cType==C_ADDR_BOOLEAN_PARAM[0])
		return "Booleen";

	if(cType==C_ACTION_PARAM[0] ||
		 cType==C_ADDR_ACTION_PARAM[0])
		return "Action";

//	if(cType==C_STATE_PARAM[0])
//		return "Etat";

	if(cType==C_ZDE_PERSO_PARAM[0])
		return "Zde perso";

	if(cType==C_ZDD_PERSO_PARAM[0])
		return "Zdd perso";

	if(cType==C_ZDM_PERSO_PARAM[0])
		return "Zdm perso";

	if(cType==C_ZDR_PERSO_PARAM[0])
		return "Zdr perso";

	if(cType==C_CHANNEL_PARAM[0] ||
		 cType==C_MODULE_PARAM[0])
		return "Canal";

	if(cType==C_ZDE_MODULE_PARAM[0])
		return "Zde module";

	if(cType==C_ZDD_MODULE_PARAM[0])
		return "Zdd module";

	if(cType==C_BUTTON_PARAM[0])
		return "Bouton";

	if(cType==C_STRING_PARAM[0])
		return "Chaine";

	if(cType==C_TEXT_PARAM[0])
		return "Texte";

	if(cType==C_FONT_PARAM[0])
		return "Fonte";

	if(cType==C_MAP_PARAM[0])
		return "Map";

	if(cType==C_MASK_PARAM[0])
		return "Type de zone";

	if(cType==C_SURFACE_PARAM[0])
		return "Surface";

	if(cType==C_LIPSYNCHRO_PARAM[0])
		return "LipSynchro";

	if(cType==C_SECTOR_PARAM[0])
		return "Secteur";

	if(cType==C_SUPEROBJECT_PARAM[0])
		return "SuperObjet";

	if(cType==C_FAMILY_PARAM[0])
		return "Famille";

	if(cType==C_MODEL_PARAM[0])
		return "Modele";

	if(cType==C_POWER_PARAM[0])
		return "Pouvoir";

	if(cType==C_SOUNDEVENT_PARAM[0])
		return "Son";

	if(cType==C_INTELL_COMPORT_PARAM[0])
		return "Comportement IA";

	if(cType==C_REFLEX_COMPORT_PARAM[0])
		return "Comportement Reflexe";

	if(cType==C_MY_INTELL_COMPORT_PARAM[0])
		return "Mon Comportement IA";

	if(cType==C_MY_REFLEX_COMPORT_PARAM[0])
		return "Mon Comportement Reflexe";

	if(cType==C_ENV_PARAM[0])
		return "Environnement";

	if(cType==C_OBJECTTABLE_PARAM[0])
		return "Table d'objets";

	if(cType==C_PARTICLEGENERATOR_PARAM[0])
		return "Générateur de Particules";

	if(cType==C_GMT_PARAM[0] ||
		 cType==C_ADDR_GMT_PARAM[0])
		return "GameMaterial";

	if(cType==C_LIGHT_PARAM[0])
		return "Lumière";

	if(cType==C_CAPS_PARAM[0] ||
		 cType==C_ADDR_CAPS_PARAM[0])
		return "Capacités";

  if(cType==C_GRAPH_PARAM[0] ||
		 cType==C_ADDR_GRAPH_PARAM[0])
		return "Réseau (Graph)";

	return "Inconnu !!!";
}

/**********************************************************************************/
CString fn_csGetParamTypeInEnglish(char cType)
{
	if(cType==C_LONG_PARAM[0] ||
		 cType==C_ADDR_LONG_PARAM[0])
		return "Constant";

	if(cType==C_REAL_PARAM[0] ||
		 cType==C_ADDR_REAL_PARAM[0])
		return "Real";

	if(cType==C_PERSO_PARAM[0] ||
		 cType==C_ADDR_PERSO_PARAM[0])
		return "Character";

	if(cType==C_ALWAYS_PARAM[0])
		return "Always";

	if(cType==C_PERSO_PARAM_ONLY[0])
		return "Character (no dsg var)";

	if(cType==C_VECTOR_PARAM[0] ||
		 cType==C_ADDR_VECTOR_PARAM[0])
		return "Vector";

	if(cType==C_WAYPOINT_PARAM[0] ||
		 cType==C_ADDR_WAYPOINT_PARAM[0])
		return "WayPoint";

	if(cType==C_LIST_PARAM[0] ||
		 cType==C_ADDR_LIST_PARAM[0])
		return "Perso List";

	if(cType==C_BOOLEAN_PARAM[0] ||
		 cType==C_ADDR_BOOLEAN_PARAM[0])
		return "Boolean";

	if(cType==C_ACTION_PARAM[0] ||
		 cType==C_ADDR_ACTION_PARAM[0])
		return "Action";

//	if(cType==C_STATE_PARAM[0])
//		return "State";

	if(cType==C_ZDE_PERSO_PARAM[0])
		return "Zde perso";

	if(cType==C_ZDD_PERSO_PARAM[0])
		return "Zdd perso";

	if(cType==C_ZDM_PERSO_PARAM[0])
		return "Zdm perso";

	if(cType==C_ZDR_PERSO_PARAM[0])
		return "Zdr perso";

	if(cType==C_CHANNEL_PARAM[0] ||
		 cType==C_MODULE_PARAM[0])
		return "Channel";

	if(cType==C_ZDE_MODULE_PARAM[0])
		return "Zde modul";

	if(cType==C_ZDD_MODULE_PARAM[0])
		return "Zdd modul";

	if(cType==C_BUTTON_PARAM[0])
		return "Button";

	if(cType==C_STRING_PARAM[0])
		return "String";

	if(cType==C_TEXT_PARAM[0])
		return "Text";

	if(cType==C_FONT_PARAM[0])
		return "Font";

	if(cType==C_MAP_PARAM[0])
		return "Map";

	if(cType==C_MASK_PARAM[0])
		return "Event zone";

	if(cType==C_SURFACE_PARAM[0])
		return "Surface";

	if(cType==C_LIPSYNCHRO_PARAM[0])
		return "LipSynchro";

	if(cType==C_SECTOR_PARAM[0])
		return "Sector";

	if(cType==C_SUPEROBJECT_PARAM[0])
		return "SuperObject";

	if(cType==C_FAMILY_PARAM[0])
		return "Family";

	if(cType==C_MODEL_PARAM[0])
		return "Model";

	if(cType==C_POWER_PARAM[0])
		return "Power";

	if(cType==C_SOUNDEVENT_PARAM[0])
		return "Sound";

	if(cType==C_INTELL_COMPORT_PARAM[0])
		return "IA Behaviour";

	if(cType==C_REFLEX_COMPORT_PARAM[0])
		return "Reflex Behaviour";

	if(cType==C_MY_INTELL_COMPORT_PARAM[0])
		return "My IA Behaviour";

	if(cType==C_MY_REFLEX_COMPORT_PARAM[0])
		return "My IA Reflex Behaviour";

	if(cType==C_ENV_PARAM[0])
		return "Environment";

	if(cType==C_OBJECTTABLE_PARAM[0])
		return "Objects Table";

	if(cType==C_PARTICLEGENERATOR_PARAM[0])
		return "Particles Generator";

	if(cType==C_GMT_PARAM[0] ||
		 cType==C_ADDR_GMT_PARAM[0])
		return "GameMaterial";

	if(cType==C_LIGHT_PARAM[0])
		return "Light";

	if(cType==C_CAPS_PARAM[0] ||
		 cType==C_ADDR_CAPS_PARAM[0])
		return "Capabilities";

  if(cType==C_GRAPH_PARAM[0] ||
		 cType==C_ADDR_GRAPH_PARAM[0])
		return "Graph";

	return "Unknown !!!";
}

/**********************************************************************************/
CString fn_csGetParamsTypes(CString csTypes)
{
	CString	csParamsTypes;

	for(int iIndex=0;iIndex<csTypes.GetLength();iIndex++)
		csParamsTypes+=fn_csGetParamType(csTypes[iIndex])+",";

	return csParamsTypes.Left(csParamsTypes.GetLength()-1);
}

/**********************************************************************************/
CString fn_csGetInfoAboutCondition(CStringList &cslHelpWordsList,long lCondIndex)
{
		CString	csConditionInfo;
		
		csConditionInfo=fn_csGetConditionEditorNameFromId(lCondIndex);
		if(!fn_bHelpIsAvailable(cslHelpWordsList,csConditionInfo))
			csConditionInfo="(*)"+csConditionInfo;
		csConditionInfo+="("+fn_csGetParamsTypes(szGetConditionTypeInParamFromId(M_CONDITIONID(lCondIndex)))+")";

		return csConditionInfo;
}

/**********************************************************************************/
CString fn_csGetInfoAboutMetaAction(CStringList &cslHelpWordsList,long lMetaActIndex)
{
		CString	csMetaActionInfo;
		
		csMetaActionInfo=fn_csGetMetaActionEditorNameFromId(lMetaActIndex);
		if(!fn_bHelpIsAvailable(cslHelpWordsList,csMetaActionInfo))
			csMetaActionInfo="(*)"+csMetaActionInfo;
		csMetaActionInfo+="("+fn_csGetParamsTypes(szGetMetaActionTypeInParamFromId(M_METAACTID(lMetaActIndex)))+")";

		return csMetaActionInfo;
}

/**********************************************************************************/
CString fn_csGetInfoAboutProcedure(CStringList &cslHelpWordsList,long lProcIndex)
{
		CString	csProcedureInfo;
		
		csProcedureInfo=fn_csGetProcedureEditorNameFromId(lProcIndex);
		if(!fn_bHelpIsAvailable(cslHelpWordsList,csProcedureInfo))
			csProcedureInfo="(*)"+csProcedureInfo;
		csProcedureInfo+="("+fn_csGetParamsTypes(szGetProcedureTypeInParamFromId(M_PROCEDUREID(lProcIndex)))+")";

		return csProcedureInfo;
}

/**********************************************************************************/
CString fn_csGetInfoAboutFunction(CStringList &cslHelpWordsList,long lFuncIndex)
{
		CString	csFunctionInfo;

		csFunctionInfo=fn_csGetParamsTypes(szGetFunctionTypeOutParamFromId(M_FUNCTIONID(lFuncIndex)))+"=";
		csFunctionInfo+=fn_csGetFunctionEditorNameFromId(lFuncIndex);
		if(!fn_bHelpIsAvailable(cslHelpWordsList,fn_csGetFunctionEditorNameFromId(lFuncIndex)))
			csFunctionInfo="(*)"+csFunctionInfo;
		csFunctionInfo+="("+fn_csGetParamsTypes(szGetFunctionTypeInParamFromId(M_FUNCTIONID(lFuncIndex)))+")";

		return csFunctionInfo;
}

/**********************************************************************************/
BOOL fn_bHelpIsAvailable(CStringList &cslHelpWordsList,CString csWord)
{
	return cslHelpWordsList.Find(csWord)!=NULL;
}

/**********************************************************************************/
void fn_vCreateKnownWordsFile()
{
	CStdioFile	cfFile;
	BOOL				bIsOpened=FALSE;

	bIsOpened=cfFile.Open("KnownWords.txt",CFile::modeCreate|CFile::modeWrite|CFile::typeText);

	if(bIsOpened)
	{
		CStringList	cslHelpConditionWordsList;
		CStringList	cslHelpFunctionWordsList;
		CStringList	cslHelpMetaActionWordsList;
		CStringList	cslHelpProcedureWordsList;

		//Gets words with help file
		CStdioFile	cfHelpFile;
		if(cfHelpFile.Open("HelpWords.txt",CFile::modeRead|CFile::typeText))
		{
			CString			csLine;
			CStringList	*pcslHelpWordsList=NULL;

			while(cfHelpFile.ReadString(csLine))
			{
				if(csLine.CompareNoCase("Conditions")==0)
					pcslHelpWordsList=&cslHelpConditionWordsList;
				else
				if(csLine.CompareNoCase("Fonctions")==0 || csLine.CompareNoCase("Functions")==0)
					pcslHelpWordsList=&cslHelpFunctionWordsList;
				else
				if(csLine.CompareNoCase("MetaActions")==0)
					pcslHelpWordsList=&cslHelpMetaActionWordsList;
				else
				if(csLine.CompareNoCase("Procedures")==0)
					pcslHelpWordsList=&cslHelpProcedureWordsList;

				if(pcslHelpWordsList!=NULL)
					pcslHelpWordsList->AddTail(csLine);
			}
		}

		//Writes caption
		cfFile.WriteString("Legend\n");
		cfFile.WriteString("------\n");
		cfFile.WriteString("(*) : No help is available\n");
		cfFile.WriteString("(+) : Obsolete keyword with help\n");
		cfFile.WriteString("\n");

		// Inserts known conditions
		cfFile.WriteString("Conditions :\n");
		cfFile.WriteString("------------\n");
		for(long lCondIndex=0;M_IsConditionIdValid(lCondIndex);lCondIndex++)
			cfFile.WriteString(fn_csGetInfoAboutCondition(cslHelpConditionWordsList,lCondIndex)+"\n");

		// Inserts known metaactions
		cfFile.WriteString("\n");
		cfFile.WriteString("MetaActions :\n");
		cfFile.WriteString("-------------\n");
		for(long lMetaActIndex=0;M_IsMetaActionIdValid(lMetaActIndex);lMetaActIndex++)
			cfFile.WriteString(fn_csGetInfoAboutMetaAction(cslHelpMetaActionWordsList,lMetaActIndex)+"\n");

		// Inserts known procedures
		cfFile.WriteString("\n");
		cfFile.WriteString("Procedures :\n");
		cfFile.WriteString("------------\n");
		for(long lProcIndex=0;M_IsProcedureIdValid(lProcIndex);lProcIndex++)
			cfFile.WriteString(fn_csGetInfoAboutProcedure(cslHelpProcedureWordsList,lProcIndex)+"\n");

		// Inserts known functions
		cfFile.WriteString("\n");
		cfFile.WriteString("Functions :\n");
		cfFile.WriteString("-----------\n");
		for(long lFuncIndex=0;M_IsFuncIdValid(lFuncIndex);lFuncIndex++)
			cfFile.WriteString(fn_csGetInfoAboutFunction(cslHelpFunctionWordsList,lFuncIndex)+"\n");

		cfFile.Close();
	}
}
#endif //D_GENERATE_KNOWNWORDS

/**********************************************************************************/
tdstEngineObject *fn_pstGetMainActor()
{
	return M_GetEngineObject(MC_fn_hGetCharacterInMainCharacterNode(MC_fn_hGetFirstMainCharNode()));
}

/**********************************************************************************/
/*tdstEngineObject *fn_pstGetWorld()
{
	if(g_stEngineStructure.h_WorldCaracter!=NULL)
		return M_GetEngineObject(g_stEngineStructure.h_WorldCaracter);
	else
	{
		AfxMessageBox("Check if the MS World is allocated in your world.car");
		AfxMessageBox("Warn your best programmer (Yves Babitch) !!");

		return NULL;
	}
}*/

/**********************************************************************************/
CStringList	*fn_pclGetListIATypeObjects()
{
	CStringList	*pclStringList=new CStringList;

	//Perso
	pclStringList->AddTail(C_szActorInstanceTypeName);

	//ZDE
	pclStringList->AddTail(C_szZdeName);

	//ZDM
	pclStringList->AddTail(C_szZdmName);

	//ZDD
	pclStringList->AddTail(C_szZddName);

	//ZDR
	pclStringList->AddTail(C_szZdrName);

	//Action
	pclStringList->AddTail(C_szActionTypeName);

	//State
	pclStringList->AddTail(C_szStateTypeName);

	//WayPoint
	pclStringList->AddTail(C_szWayPointTypeName);

	//Surface
	pclStringList->AddTail(C_szSurfaceTypeName);

	//Environment
	pclStringList->AddTail(C_szEnvironmentTypeName);

	//LipSynchro
	pclStringList->AddTail(C_szLipSyncTypeName);

	//Sector
	pclStringList->AddTail(C_szSectorTypeName);

	//SuperObject
	pclStringList->AddTail(C_SUPEROBJECTTYPE);

	//ObjectTable
	pclStringList->AddTail(C_szObjectTableTypeName);

	//Family
	pclStringList->AddTail(C_szFamilyTypeName);

	//Model
	pclStringList->AddTail(C_szActorModelTypeName);

	//SoundEvent
	pclStringList->AddTail(C_szSoundEventTypeName);

	//GameMaterial
	pclStringList->AddTail(C_szGameMaterialTypeName);

	//Light
	pclStringList->AddTail(C_szLightTypeName);

	//Behaviour
	pclStringList->AddTail(C_szIABehaviourTypeName);

	//MaskType
	pclStringList->AddTail(C_szMaterialColName);

	//Channel
	pclStringList->AddTail(C_CHANNELTYPE);

	//Text
	pclStringList->AddTail(C_TEXTTYPE);

	//Font
	pclStringList->AddTail(C_FONTTYPE);

	//ParticlesGenerator
	pclStringList->AddTail(C_szPartGenGeneratorName);

//Stefan Dumitrean 18-05-98
	//Graphs
	pclStringList->AddTail(C_szGraphTypeName);

	//Macros
	pclStringList->AddTail(C_szIAMacroTypeName);

	//Subroutines
	pclStringList->AddTail(C_szIASubroutineTypeName);
//End Stefan Dumitrean

	return pclStringList;
}

/**********************************************************************************/
void fn_vAddListOfKnownEditorType(CStringList *pclStringList,CString csTypeName)
{
	CPA_List<CPA_BaseObject>	clObjectsList;
	g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clObjectsList,"",csTypeName);

	POSITION		pos=clObjectsList.GetHeadPosition();
	while(pos!=NULL)
		pclStringList->AddTail(clObjectsList.GetNext(pos)->GetName());
}

/**********************************************************************************/
void fn_vAddListOfPersos(CStringList *pclStringList)
{
	fn_vAddListOfKnownEditorType(pclStringList,C_szActorInstanceTypeName);
}

/**********************************************************************************/
void fn_vAddListOfZdd(CStringList *pclStringList)
{
	CPA_List<CPA_BaseObject>	clObjectsList;
	g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clObjectsList,"",C_szZDdNameListType);

	POSITION	pos=clObjectsList.GetHeadPosition();
	while(pos!=NULL)
	{
		CPA_tdoNameList	*pclNameList=(CPA_tdoNameList *)clObjectsList.GetNext(pos);
		POSITION	p=pclNameList->GetHeadPosition();
		while(p!=NULL)
			pclStringList->AddTail(pclNameList->GetNext(p)->GetName());
	}
}

/**********************************************************************************/
void fn_vAddListOfZde(CStringList *pclStringList)
{
	CPA_List<CPA_BaseObject>	clObjectsList;
	g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clObjectsList,"",C_szZDeNameListType);

	POSITION	pos=clObjectsList.GetHeadPosition();
	while(pos!=NULL)
	{
		CPA_tdoNameList	*pclNameList=(CPA_tdoNameList *)clObjectsList.GetNext(pos);
		POSITION	p=pclNameList->GetHeadPosition();
		while(p!=NULL)
			pclStringList->AddTail(pclNameList->GetNext(p)->GetName());
	}
}

/**********************************************************************************/
void fn_vAddListOfZdm(CStringList *pclStringList)
{
	CPA_List<CPA_BaseObject>	clObjectsList;
	g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clObjectsList,"",C_szZDmNameListType);

	POSITION	pos=clObjectsList.GetHeadPosition();
	while(pos!=NULL)
	{
		CPA_tdoNameList	*pclNameList=(CPA_tdoNameList *)clObjectsList.GetNext(pos);
		POSITION	p=pclNameList->GetHeadPosition();
		while(p!=NULL)
			pclStringList->AddTail(pclNameList->GetNext(p)->GetName());
	}
}

/**********************************************************************************/
void fn_vAddListOfZdr(CStringList *pclStringList)
{
	CPA_List<CPA_BaseObject>	clObjectsList;
	g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clObjectsList,"",C_szZDrNameListType);

	POSITION	pos=clObjectsList.GetHeadPosition();
	while(pos!=NULL)
	{
		CPA_tdoNameList	*pclNameList=(CPA_tdoNameList *)clObjectsList.GetNext(pos);
		POSITION	p=pclNameList->GetHeadPosition();
		while(p!=NULL)
			pclStringList->AddTail(pclNameList->GetNext(p)->GetName());
	}
}

/**********************************************************************************/
void fn_vAddListOfActions(CStringList *pclStringList)
{
	fn_vAddListOfKnownEditorType(pclStringList,C_szActionTypeName);
}

/**********************************************************************************/
void fn_vAddListOfStates(CStringList *pclStringList)
{
	fn_vAddListOfKnownEditorType(pclStringList,C_szStateTypeName);
}

/**********************************************************************************/
void fn_vAddListOfWayPoints(CStringList *pclStringList)
{
	fn_vAddListOfKnownEditorType(pclStringList,C_szWayPointTypeName);
}

/**********************************************************************************/
void fn_vAddListOfSurfaces(CStringList *pclStringList)
{
	fn_vAddListOfKnownEditorType(pclStringList,C_szSurfaceTypeName);
}

/**********************************************************************************/
void fn_vAddListOfEnvironments(CStringList *pclStringList)
{
	fn_vAddListOfKnownEditorType(pclStringList,C_szEnvironmentTypeName);
}

/**********************************************************************************/
void fn_vAddListOfLipSynchros(CStringList *pclStringList)
{
	fn_vAddListOfKnownEditorType(pclStringList,C_szLipSyncTypeName);
}

/**********************************************************************************/
void fn_vAddListOfSectors(CStringList *pclStringList)
{
	CPA_List<CPA_SuperObject>	*pclList;
	pclList=g_pclAIInterface->GetMainWorld()->GetInterface()->GetObjectListByType(C_szSectorTypeName);
	POSITION	pos=pclList->GetHeadPosition();
	while(pos!=NULL)
	{
		CPA_BaseObject	*pclObject=pclList->GetNext(pos)->GetObject();
		if(pclObject!=NULL)
			pclStringList->AddTail(pclObject->GetName());
	}
}

/**********************************************************************************/
void fn_vAddListOfSuperObjects(CStringList *pclStringList)
{
	CPA_List<CPA_SuperObject>	*pclList;
	pclList=g_pclAIInterface->GetMainWorld()->GetWorld()->GetListAllObjects();
	POSITION	pos=pclList->GetHeadPosition();
	while(pos!=NULL)
	{
		pclStringList->AddTail(pclList->GetNext(pos)->GetName());
	}
}

/**********************************************************************************/
void fn_vAddListOfObjectTables(CStringList *pclStringList)
{
	fn_vAddListOfKnownEditorType(pclStringList,C_szObjectTableTypeName);
}

/**********************************************************************************/
void fn_vAddListOfFamilies(CStringList *pclStringList)
{
	fn_vAddListOfKnownEditorType(pclStringList,C_szFamilyTypeName);
}

/**********************************************************************************/
void fn_vAddListOfModels(CStringList *pclStringList)
{
	fn_vAddListOfKnownEditorType(pclStringList,C_szActorModelTypeName);
}

/**********************************************************************************/
void fn_vAddListOfSoundEvents(CStringList *pclStringList)
{
	fn_vAddListOfKnownEditorType(pclStringList,C_szSoundEventTypeName);
}

/**********************************************************************************/
void fn_vAddListOfGameMaterials(CStringList *pclStringList)
{
	fn_vAddListOfKnownEditorType(pclStringList,C_szGameMaterialTypeName);
}

/**********************************************************************************/
void fn_vAddListOfLights(CStringList *pclStringList)
{
	fn_vAddListOfKnownEditorType(pclStringList,C_szLightTypeName);
}

/**********************************************************************************/
void fn_vAddListOfBehaviours(CStringList *pclStringList)
{
	fn_vAddListOfKnownEditorType(pclStringList,C_szIABehaviourTypeName);
}

/**********************************************************************************/
void fn_vAddListOfMaskTypes(CStringList *pclStringList)
{
	fn_vAddListOfKnownEditorType(pclStringList,C_szMaterialColName);
}

/**********************************************************************************/
void fn_vAddListOfChannels(CStringList *pclStringList)
{
	//Gets Family List
	CPA_List<CPA_BaseObject>	clFamilyList;
	g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clFamilyList,"",C_szFamilyTypeName);

	//Adds Channel Name for each family
	POSITION	pos=clFamilyList.GetHeadPosition();
	while(pos!=NULL)
	{
		CPA_Family	*pclFamily=(CPA_Family *)clFamilyList.GetNext(pos);

		POSITION	p=pclFamily->m_oListOfChannelsName.GetHeadPosition();
		while(p!=NULL)
			pclStringList->AddTail(pclFamily->m_oListOfChannelsName.GetNext(p));
	}
}

/**********************************************************************************/
void fn_vAddListOfTexts(CStringList *pclStringList)
{
}

/**********************************************************************************/
void fn_vAddListOfFonts(CStringList *pclStringList)
{
}

/**********************************************************************************/
void fn_vAddListOfParticlesGenerator(CStringList *pclStringList)
{
	fn_vAddListOfKnownEditorType(pclStringList,C_szPartGenGeneratorName);
}

/**********************************************************************************/
CStringList	*fn_pclGetListIAObjects(CString csType)
{
	CStringList	*pclStringList=new CStringList;

	if(csType.IsEmpty())
	{
		fn_vAddListOfPersos(pclStringList);
		fn_vAddListOfZdd(pclStringList);
		fn_vAddListOfZde(pclStringList);
		fn_vAddListOfZdm(pclStringList);
		fn_vAddListOfZdr(pclStringList);
		fn_vAddListOfActions(pclStringList);
		fn_vAddListOfStates(pclStringList);
		fn_vAddListOfWayPoints(pclStringList);
		fn_vAddListOfSurfaces(pclStringList);
		fn_vAddListOfEnvironments(pclStringList);
		fn_vAddListOfLipSynchros(pclStringList);
		fn_vAddListOfSectors(pclStringList);
		fn_vAddListOfSuperObjects(pclStringList);
		fn_vAddListOfObjectTables(pclStringList);
		fn_vAddListOfFamilies(pclStringList);
		fn_vAddListOfModels(pclStringList);
		fn_vAddListOfSoundEvents(pclStringList);
		fn_vAddListOfGameMaterials(pclStringList);
		fn_vAddListOfLights(pclStringList);
		fn_vAddListOfBehaviours(pclStringList);
		fn_vAddListOfMaskTypes(pclStringList);
		fn_vAddListOfChannels(pclStringList);
		fn_vAddListOfTexts(pclStringList);
		fn_vAddListOfFonts(pclStringList);
		fn_vAddListOfParticlesGenerator(pclStringList);
	}
	else
	{
		if(csType==C_szActorInstanceTypeName)
			fn_vAddListOfPersos(pclStringList);
		else
		if(csType==C_szZddName)
			fn_vAddListOfZdd(pclStringList);
		else
		if(csType==C_szZdeName)
			fn_vAddListOfZde(pclStringList);
		else
		if(csType==C_szZdmName)
			fn_vAddListOfZdm(pclStringList);
		else
		if(csType==C_szZdrName)
			fn_vAddListOfZdr(pclStringList);
		else
		if(csType==C_szActionTypeName)
			fn_vAddListOfActions(pclStringList);
		else
		if(csType==C_szStateTypeName)
			fn_vAddListOfStates(pclStringList);
		else
		if(csType==C_szWayPointTypeName)
			fn_vAddListOfWayPoints(pclStringList);
		else
		if(csType==C_szSurfaceTypeName)
			fn_vAddListOfSurfaces(pclStringList);
		else
		if(csType==C_szEnvironmentTypeName)
			fn_vAddListOfEnvironments(pclStringList);
		else
		if(csType==C_szLipSyncTypeName)
			fn_vAddListOfLipSynchros(pclStringList);
		else
		if(csType==C_szSectorTypeName)
			fn_vAddListOfSectors(pclStringList);
		else
		if(csType==C_SUPEROBJECTTYPE)
			fn_vAddListOfSuperObjects(pclStringList);
		else
		if(csType==C_szObjectTableTypeName)
			fn_vAddListOfObjectTables(pclStringList);
		else
		if(csType==C_szFamilyTypeName)
			fn_vAddListOfFamilies(pclStringList);
		else
		if(csType==C_szActorModelTypeName)
			fn_vAddListOfModels(pclStringList);
		else
		if(csType==C_szSoundEventTypeName)
			fn_vAddListOfSoundEvents(pclStringList);
		else
		if(csType==C_szGameMaterialTypeName)
			fn_vAddListOfGameMaterials(pclStringList);
		else
		if(csType==C_szLightTypeName)
			fn_vAddListOfLights(pclStringList);
		else
		if(csType==C_szIABehaviourTypeName)
			fn_vAddListOfBehaviours(pclStringList);
		else
		if(csType==C_szMaterialColName)
			fn_vAddListOfMaskTypes(pclStringList);
		else
		if(csType==C_CHANNELTYPE)
			fn_vAddListOfChannels(pclStringList);
		else
		if(csType==C_TEXTTYPE)
			fn_vAddListOfTexts(pclStringList);
		else
		if(csType==C_FONTTYPE)
			fn_vAddListOfFonts(pclStringList);
		else
		if(csType==C_szPartGenGeneratorName)
			fn_vAddListOfParticlesGenerator(pclStringList);
	}

	return pclStringList;
}


//Stefan Dumitrean 18-5-98
/**************************************************************************/
void fn_vAddListOfKnownEditorType( CStringList *p_clListParents, CStringList *p_clListData, CString csParent, CString csType )
{
	CPA_List<CPA_BaseObject>	clObjectsList;
	g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clObjectsList,"",csType);

	CPA_BaseObject * p_CPA_BaseObject, * p_CPA_BaseObjectP;
	CString csParentName;
	POSITION		pos=clObjectsList.GetHeadPosition();
	while(pos!=NULL)
	{
		p_CPA_BaseObject = clObjectsList.GetNext(pos);
		p_CPA_BaseObjectP = p_CPA_BaseObject->GetOwner();
		if( p_CPA_BaseObjectP )
			csParentName = p_CPA_BaseObjectP->GetName();
		else
			csParentName = "";
		if( csParent.IsEmpty() )
		{
			p_clListData->AddTail( p_CPA_BaseObject->GetName() );
			if( !( csParentName.IsEmpty() || p_clListParents->Find( csParentName ) ) )
				p_clListParents->AddTail( csParentName );
		}
		else
			if( csParentName == csParent )
				p_clListData->AddTail( p_CPA_BaseObject->GetName() );
	}
		
}


/**********************************************************************************/
void fn_vAddListOfPersos( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	fn_vAddListOfKnownEditorType(p_clListParents, p_clListData, csParent, C_szActorInstanceTypeName);
}

/**********************************************************************************/
void fn_vAddListOfZdd( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	CPA_List<CPA_BaseObject>	clObjectsList;
	g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clObjectsList,"",C_szZDdNameListType);

	CPA_BaseObject * p_CPA_BaseObject, * p_CPA_BaseObjectP;
	CString csParentName;
	POSITION	pos=clObjectsList.GetHeadPosition();
	while(pos!=NULL)
	{
		CPA_tdoNameList	*pclNameList=(CPA_tdoNameList *)clObjectsList.GetNext(pos);
		POSITION	p=pclNameList->GetHeadPosition();
		while(p!=NULL)
		{
			p_CPA_BaseObject = pclNameList->GetNext(p);
			p_CPA_BaseObjectP = p_CPA_BaseObject->GetOwner();
			if( p_CPA_BaseObjectP )
				csParentName = p_CPA_BaseObjectP->GetName();
			else
				csParentName = "";
			if( csParent.IsEmpty() )
			{
				p_clListData->AddTail( p_CPA_BaseObject->GetName() );
				if( !( csParentName.IsEmpty() || p_clListParents->Find( csParentName ) ) )
					p_clListParents->AddTail( csParentName );
			}
			else
				if( csParentName == csParent )
					p_clListData->AddTail( p_CPA_BaseObject->GetName() );
		}
	}
}

/**********************************************************************************/
void fn_vAddListOfZde( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	CPA_List<CPA_BaseObject>	clObjectsList;
	g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clObjectsList,"",C_szZDeNameListType);

	CPA_BaseObject * p_CPA_BaseObject, * p_CPA_BaseObjectP;
	CString csParentName;
	POSITION	pos=clObjectsList.GetHeadPosition();
	while(pos!=NULL)
	{
		CPA_tdoNameList	*pclNameList=(CPA_tdoNameList *)clObjectsList.GetNext(pos);
		POSITION	p=pclNameList->GetHeadPosition();
		while(p!=NULL)
		{
			p_CPA_BaseObject = pclNameList->GetNext(p);
			p_CPA_BaseObjectP = p_CPA_BaseObject->GetOwner();
			if( p_CPA_BaseObjectP )
				csParentName = p_CPA_BaseObjectP->GetName();
			else
				csParentName = "";
			if( csParent.IsEmpty() )
			{
				p_clListData->AddTail( p_CPA_BaseObject->GetName() );
				if( !( csParentName.IsEmpty() || p_clListParents->Find( csParentName ) ) )
					p_clListParents->AddTail( csParentName );
			}
			else
				if( csParentName == csParent )
					p_clListData->AddTail( p_CPA_BaseObject->GetName() );
		}
	}
}

/**********************************************************************************/
void fn_vAddListOfZdm( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	CPA_List<CPA_BaseObject>	clObjectsList;
	g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clObjectsList,"",C_szZDmNameListType);

	CPA_BaseObject * p_CPA_BaseObject, * p_CPA_BaseObjectP;
	CString csParentName;
	POSITION	pos=clObjectsList.GetHeadPosition();
	while(pos!=NULL)
	{
		CPA_tdoNameList	*pclNameList=(CPA_tdoNameList *)clObjectsList.GetNext(pos);
		POSITION	p=pclNameList->GetHeadPosition();
		while(p!=NULL)
		{
			p_CPA_BaseObject = pclNameList->GetNext(p);
			p_CPA_BaseObjectP = p_CPA_BaseObject->GetOwner();
			if( p_CPA_BaseObjectP )
				csParentName = p_CPA_BaseObjectP->GetName();
			else
				csParentName = "";
			if( csParent.IsEmpty() )
			{
				p_clListData->AddTail( p_CPA_BaseObject->GetName() );
				if( !( csParentName.IsEmpty() || p_clListParents->Find( csParentName ) ) )
					p_clListParents->AddTail( csParentName );
			}
			else
				if( csParentName == csParent )
					p_clListData->AddTail( p_CPA_BaseObject->GetName() );
		}
	}
}

/**********************************************************************************/
void fn_vAddListOfZdr( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	CPA_List<CPA_BaseObject>	clObjectsList;
	g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clObjectsList,"",C_szZDrNameListType);

	CPA_BaseObject * p_CPA_BaseObject, * p_CPA_BaseObjectP;
	CString csParentName;
	POSITION	pos=clObjectsList.GetHeadPosition();
	while(pos!=NULL)
	{
		CPA_tdoNameList	*pclNameList=(CPA_tdoNameList *)clObjectsList.GetNext(pos);
		POSITION	p=pclNameList->GetHeadPosition();
		while(p!=NULL)
		{
			p_CPA_BaseObject = pclNameList->GetNext(p);
			p_CPA_BaseObjectP = p_CPA_BaseObject->GetOwner();
			if( p_CPA_BaseObjectP )
				csParentName = p_CPA_BaseObjectP->GetName();
			else
				csParentName = "";
			if( csParent.IsEmpty() )
			{
				p_clListData->AddTail( p_CPA_BaseObject->GetName() );
				if( !( csParentName.IsEmpty() || p_clListParents->Find( csParentName ) ) )
					p_clListParents->AddTail( csParentName );
			}
			else
				if( csParentName == csParent )
					p_clListData->AddTail( p_CPA_BaseObject->GetName() );
		}
	}
}

/**********************************************************************************/
void fn_vAddListOfActions( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	fn_vAddListOfKnownEditorType( p_clListParents, p_clListData, csParent, C_szActionTypeName);
}

/**********************************************************************************/
void fn_vAddListOfStates( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	fn_vAddListOfKnownEditorType( p_clListParents, p_clListData, csParent, C_szStateTypeName);
}

/**********************************************************************************/
void fn_vAddListOfWayPoints( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	fn_vAddListOfKnownEditorType( p_clListParents, p_clListData, csParent, C_szWayPointTypeName);
}

/**********************************************************************************/
void fn_vAddListOfSurfaces( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	fn_vAddListOfKnownEditorType( p_clListParents, p_clListData, csParent, C_szSurfaceTypeName);
}

/**********************************************************************************/
void fn_vAddListOfEnvironments( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	fn_vAddListOfKnownEditorType( p_clListParents, p_clListData, csParent, C_szEnvironmentTypeName);
}

/**********************************************************************************/
void fn_vAddListOfLipSynchros( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	fn_vAddListOfKnownEditorType( p_clListParents, p_clListData, csParent, C_szLipSyncTypeName);
}

/**********************************************************************************/
void fn_vAddListOfSectors( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	CPA_List<CPA_SuperObject>	*pclList;
	pclList=g_pclAIInterface->GetMainWorld()->GetInterface()->GetObjectListByType(C_szSectorTypeName);

//Stefan Dumitrean 12-09-98
	CPA_SuperObject * p_CPA_BaseObjectP;
//End Stefan Dumitrean 12-09-98
	CString csParentName;
	POSITION	pos=pclList->GetHeadPosition();
	while(pos!=NULL)
	{
//Stefan Dumitrean 12-09-98
		CPA_SuperObject	*pclObject=pclList->GetNext(pos);//->GetObject();
//End Stefan Dumitrean 12-09-98
		if(pclObject!=NULL)
		{
//Stefan Dumitrean 12-09-98
			p_CPA_BaseObjectP = pclObject->GetSuperObjectFather();//GetOwner();
//End Stefan Dumitrean 12-09-98
			if( p_CPA_BaseObjectP )
				csParentName = p_CPA_BaseObjectP->GetName();
			else
				csParentName = "";
			if( csParent.IsEmpty() )
			{
				p_clListData->AddTail( pclObject->GetName() );
				if( !( csParentName.IsEmpty() || p_clListParents->Find( csParentName ) ) )
					p_clListParents->AddTail( csParentName );
			}
			else
				if( csParentName == csParent )
					p_clListData->AddTail( pclObject->GetName() );
		}
	}
}

/**********************************************************************************/
void fn_vAddListOfSuperObjects( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	CPA_List<CPA_SuperObject>	*pclList;
	pclList=g_pclAIInterface->GetMainWorld()->GetWorld()->GetListAllObjects();

//Stefan Dumitrean 1-06-98
	CPA_SuperObject * p_CPA_BaseObject, * p_CPA_BaseObjectP;
//End Stefan Dumitrean 1-06-98

	CString csParentName;
	POSITION	pos=pclList->GetHeadPosition();
	while(pos!=NULL)
	{
		p_CPA_BaseObject = pclList->GetNext(pos);
//Stefan Dumitrean 1-06-98
		p_CPA_BaseObjectP = p_CPA_BaseObject->GetSuperObjectFather();
//End Stefan Dumitrean 1-06-98
		if( p_CPA_BaseObjectP )
			csParentName = p_CPA_BaseObjectP->GetName();
		else
			csParentName = "";
		if( csParent.IsEmpty() )
		{
			p_clListData->AddTail( p_CPA_BaseObject->GetName() );
			if( !( csParentName.IsEmpty() || p_clListParents->Find( csParentName ) ) )
				p_clListParents->AddTail( csParentName );
		}
		else
			if( csParentName == csParent )
				p_clListData->AddTail( p_CPA_BaseObject->GetName() );
	}
}

/**********************************************************************************/
void fn_vAddListOfObjectTables( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	fn_vAddListOfKnownEditorType( p_clListParents, p_clListData, csParent, C_szObjectTableTypeName);
}

/**********************************************************************************/
void fn_vAddListOfFamilies( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	fn_vAddListOfKnownEditorType( p_clListParents, p_clListData, csParent, C_szFamilyTypeName);
}

/**********************************************************************************/
void fn_vAddListOfModels( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	fn_vAddListOfKnownEditorType( p_clListParents, p_clListData, csParent, C_szActorModelTypeName);
}

/**********************************************************************************/
void fn_vAddListOfSoundEvents( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	fn_vAddListOfKnownEditorType( p_clListParents, p_clListData, csParent, C_szSoundEventTypeName);
}

/**********************************************************************************/
void fn_vAddListOfGameMaterials( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	fn_vAddListOfKnownEditorType( p_clListParents, p_clListData, csParent, C_szGameMaterialTypeName);
}

/**********************************************************************************/
void fn_vAddListOfLights( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	fn_vAddListOfKnownEditorType( p_clListParents, p_clListData, csParent, C_szLightTypeName);
}

/**********************************************************************************/
void fn_vAddListOfBehaviours( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	fn_vAddListOfKnownEditorType( p_clListParents, p_clListData, csParent, C_szIABehaviourTypeName);
}

/**********************************************************************************/
void fn_vAddListOfMaskTypes( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	fn_vAddListOfKnownEditorType( p_clListParents, p_clListData, csParent, C_szMaterialColName);
}

/**********************************************************************************/
void fn_vAddListOfChannels( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	//Gets Family List
	CPA_List<CPA_BaseObject>	clFamilyList;
	g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clFamilyList,"",C_szFamilyTypeName);

	//Adds Channel Name for each family
	CString csParentName, csName;;
	POSITION	pos=clFamilyList.GetHeadPosition();
	while(pos!=NULL)
	{
		CPA_Family	*pclFamily=(CPA_Family *)clFamilyList.GetNext(pos);
		csParentName = pclFamily->GetName();

		POSITION	p=pclFamily->m_oListOfChannelsName.GetHeadPosition();
		while(p!=NULL)
//			pclStringList->AddTail(pclFamily->m_oListOfChannelsName.GetNext(p));
		{
			csName = pclFamily->m_oListOfChannelsName.GetNext(p);
			if( csParent.IsEmpty() )
			{
				p_clListData->AddTail( csName );
				if( !( csParentName.IsEmpty() || p_clListParents->Find( csParentName ) ) )
					p_clListParents->AddTail( csParentName );
			}
			else
				if( csParentName == csParent )
					p_clListData->AddTail( csName );
		}
	}
}

/**********************************************************************************/
void fn_vAddListOfTexts( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
}

/**********************************************************************************/
void fn_vAddListOfFonts( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
}

/**********************************************************************************/
void fn_vAddListOfParticlesGenerator( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	fn_vAddListOfKnownEditorType( p_clListParents, p_clListData, csParent, C_szPartGenGeneratorName);
}

/**********************************************************************************/
void fn_vAddListOfGraphs( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	fn_vAddListOfKnownEditorType( p_clListParents, p_clListData, csParent, C_szGraphTypeName);
}

/**********************************************************************************/
void fn_vAddListOfMacros( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	POSITION pos;
	CString csString;
	void * p_Dummy;
	if( g_clMacroList.map )
	{	
		pos = g_clMacroList.map->GetStartPosition();
		while( pos )
		{ 
			g_clMacroList.map->GetNextAssoc( pos, csString, p_Dummy );
			p_clListData->AddTail( csString );
		}
	}
}

/**********************************************************************************/
void fn_vAddListOfSubroutines( CStringList *p_clListParents, CStringList *p_clListData, CString csParent )
{
	CPA_EdIR_MainBehaviourList * p_clSubroutineList;
	CPA_BaseObject * p_clBaseObject;
	POSITION pos;
	if( g_pclAIInterface && g_pclAIInterface->m_pclIRMainFrame && g_pclAIInterface->m_pclIRMainFrame->m_pclBrain )
	{
		p_clSubroutineList = &(g_pclAIInterface->m_pclIRMainFrame->m_pclBrain->m_clListOfSubrs);
		pos = p_clSubroutineList->GetHeadPosition();
		while( pos )
		{
			p_clBaseObject = (CPA_BaseObject*)p_clSubroutineList->GetNext(pos);
			if( p_clBaseObject )
				p_clListData->AddTail(p_clBaseObject->GetName()); 
		}
	}

}


/**********************************************************************************/

void fn_vAddListOfIAObjectsForType( CStringList *p_clListParents, CStringList *p_clListData, CString csParent, CString csType )
{
		if(csType==C_szActorInstanceTypeName)
			fn_vAddListOfPersos( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_szZddName)
			fn_vAddListOfZdd( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_szZdeName)
			fn_vAddListOfZde( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_szZdmName)
			fn_vAddListOfZdm( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_szZdrName)
			fn_vAddListOfZdr( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_szActionTypeName)
			fn_vAddListOfActions( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_szStateTypeName)
			fn_vAddListOfStates( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_szWayPointTypeName)
			fn_vAddListOfWayPoints( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_szSurfaceTypeName)
			fn_vAddListOfSurfaces( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_szEnvironmentTypeName)
			fn_vAddListOfEnvironments( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_szLipSyncTypeName)
			fn_vAddListOfLipSynchros( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_szSectorTypeName)
			fn_vAddListOfSectors( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_SUPEROBJECTTYPE)
			fn_vAddListOfSuperObjects( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_szObjectTableTypeName)
			fn_vAddListOfObjectTables( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_szFamilyTypeName)
			fn_vAddListOfFamilies( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_szActorModelTypeName)
			fn_vAddListOfModels( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_szSoundEventTypeName)
			fn_vAddListOfSoundEvents( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_szGameMaterialTypeName)
			fn_vAddListOfGameMaterials( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_szLightTypeName)
			fn_vAddListOfLights( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_szIABehaviourTypeName)
			fn_vAddListOfBehaviours( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_szMaterialColName)
			fn_vAddListOfMaskTypes( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_CHANNELTYPE)
			fn_vAddListOfChannels( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_TEXTTYPE)
			fn_vAddListOfTexts( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_FONTTYPE)
			fn_vAddListOfFonts( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_szPartGenGeneratorName)
			fn_vAddListOfParticlesGenerator( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_szGraphTypeName)
			fn_vAddListOfGraphs( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_szIAMacroTypeName)
			fn_vAddListOfMacros( p_clListParents, p_clListData, csParent );
		else
		if(csType==C_szIASubroutineTypeName)
			fn_vAddListOfSubroutines( p_clListParents, p_clListData, csParent );
}
//End Stefan Dumitrean

#endif //D_ED_IR_ACTIVE
