/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_MSMagnet_StructureDefine
#define D_MSMagnet_VariableDefine
 
#include "ToolsCPA.h"
 
#include "Options/Options.h"
#include "Macros.h"
 
#include "Actions/AllActs.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h" 
 
#include "Basic.h"
#include "GameEng.h"
#include "ObjInit.h"
#include "ZeMem.h"
 
#include "ldt.h"
 
#define sTagChamp			'hC'
#define sTagSt				'tS'
#define sTagFar				'aF'
#define sTagNear			'eN'		
#define sTagDuration	'uD'
 
 
/*****************************************************************
Function name   : fn_iCreateMSMagnet
Description     : 
Author          : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date   : 13-Oct-98
Modified        : 
Return type     : int 
Argument        : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iCreateMSMagnet( LDT_tdst_Link *pLink )
{
	MS_tdxHandleToMSMagnet h_MSMagnet;
	struct tdstEngineObject_ *p_stEngineObject = (struct tdstEngineObject_ *)pLink->pParent->pObject;
 
    MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeMagnet , p_stEngineObject);
	h_MSMagnet = fn_h_MSMagnetRealAlloc();
    MMG_fn_vEndMemoryInfo ();
	p_stEngineObject->h_MSMagnet = h_MSMagnet;
 
	pLink->pObject = (void*)h_MSMagnet;
 
  return 0;
}
 
 
/*****************************************************************
Function name   : fn_iLoadMSMagnet
Description     : 
Author          : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date   : 13-Oct-98
Modified        : 
Return type     : int 
Argument        : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadMSMagnet( LDT_tdst_Link *pLink )
{
  LDT_tdeParseResult result=ParseResult_BeginSection;
	MS_tdxHandleToMSMagnet h_MSMagnet = (MS_tdxHandleToMSMagnet)pLink->pObject;
 
 
  while( result!=ParseResult_EndSection ) 
  {
  	result=LDT_GetNextEntry();
  	switch( result )
  	{
  	  case ParseResult_Entry: /* an entry */
  	  {
  	    char *szEntry=LDT_szGetEntryName();
  	    switch (*(long*)szEntry)
  	    {
 
  	      case  sTagChamp : /*  */
  	      {
  	      }
  	      break;
  	      case  sTagSt : /*  */
  	      {
						if (strlen(szEntry)>7) /*Strength*/
						{
							fn_vMSMagnetSetStrength(h_MSMagnet, (float)atof(LDT_szGetParam(1)) );
						}
						else /*Status*/
						{
							fn_vMSMagnetSetStatus(h_MSMagnet,(unsigned char)atoi(LDT_szGetParam(1)) );
						}
  	      }
  	      break;
  	      case  sTagFar : /*  */
  	      {
						fn_vMSMagnetSetFar(h_MSMagnet, (float)atof(LDT_szGetParam(1)) );
  	      }
  	      break;
  	      case  sTagNear : /*  */
  	      {
						fn_vMSMagnetSetNear(h_MSMagnet, (float)atof(LDT_szGetParam(1)) );
  	      }
  	      break;
  	      case  sTagDuration : /*  */
  	      {
						fn_vMSMagnetSetDuration(h_MSMagnet,(unsigned long)atoi(LDT_szGetParam(1)) );
  	      }
  	      break;
  	    }
  	  }
  	}
  }
 
 
  return 0;
}
 
