#if defined (WIN32)
#include <stdio.h>
#endif /* WIN32 */
 
/* to be Friend*/
#define D_State_Define
#define D_ObjsTbls_Define
 
#include "ToolsCPA.h"
 
#include "Options/Options.h"
#include "Macros.h"
 
#include "Actions/AllActs.h"
 
#include "Structur/3DOSLkTb.h"
#include "Structur/Objects.h"
#include "Structur/ErrGame.h"
#include "Structur/GameScpt.h"
#include "Structur/MemGame.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
 
 
#include "Basic.h"
#include "Family.h"
#include "ObjType.h"
#include "ZeMem.h"
#include "CHLLoad.h"
 
#include "ldt.h"
 
/* global for CHL Link Table*/
extern SCR_tdst_Link_Table CHL_g_stLinkTable;
 
 
 
/*****************************************************************
Function name   : fn_iCreateCHL
Description     : 
Author          : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date   : 13-Oct-98
Modified        : 
Return type     : int 
Argument        : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iCreateCHL( LDT_tdst_Link *pLink )
{
	struct	tdstFamilyList_ *p_stFamily;
 
  p_stFamily = 	(struct tdstFamilyList_ *)LDT_GetLinkValue(pLink->pParent);		  
  LDT_SetLinkValue(pLink->pParent, (unsigned long)p_stFamily);
 
	p_stFamily->ulNumberOfChannels = atoi(LDT_szGetParam(1));
  
 
  return 0;
}
 
 
 
/*****************************************************************
Function name   : fn_iLoadCHL
Description     : 
Author          : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date   : 13-Oct-98
Modified        : 
Return type     : int 
Argument        : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadCHL( LDT_tdst_Link *pLink )
{
  LDT_tdeParseResult result=ParseResult_BeginSection;
	long		lChannelNumber = 0;
	struct	tdstFamilyList_ *p_stFamily;
	char sz_ForLinkTable[MAX_PATH];
/*	int i, j;*/
/*	tdxHandleToObjectsTablesList hObjectsTable;*/
 
/* -> OS : THIS CODE SHOULD BE CHANGED 07-Jul-98*/
/*	p_stFamily = 	(struct tdstFamilyList_ *)LDT_GetTempLong( 0 ); */
/* <- OS : THIS CODE SHOULD BE CHANGED 07-Jul-98*/
  p_stFamily = 	(struct tdstFamilyList_ *)LDT_GetLinkValue(pLink->pParent);		  
  LDT_SetLinkValue(pLink->pParent, (unsigned long)p_stFamily);
  
 
  while( result!=ParseResult_EndSection ) 
  {
  	result=LDT_GetNextEntry();
  	switch( result )
  	{
  	  case ParseResult_Entry: /* an entry : AddChannelName*/
  	  {
			  strcpy(sz_ForLinkTable, fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType));
				strcat(sz_ForLinkTable, "-");
				strcat(sz_ForLinkTable, LDT_szGetParam(1));
		
				SCR_fnp_st_Link_SetValue(&CHL_g_stLinkTable, sz_ForLinkTable, lChannelNumber);
				lChannelNumber++;
 
  	  }
  	}
  }
 
 
 
 
  return 0;
}
 
