/*=========================================================================
* MSWay.h : MSWay's functions
* Version              1.0
* Creation date        January 21,1997
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
 
#if !defined(__MSWay_H__)
#define __MSWay_H__
 
/******************************************/
#if _MSC_VER >= 1000
#pragma once
#endif /* _MSC_VER >= 1000 */
/******************************************/
 
#include "GAM/Header.h"
/*ANNECY JMD {*/
#include "AI/AIBASE/WP_Handl.h"
#include "AI/AIBASE/WPgraphe.h"
/*ENDANNECY JMD }*/
 
 
#undef EXTERN
#undef extern
#if !defined(D_MSWay_VariableDefine)
#define EXTERN extern
#else
#define EXTERN
#endif /* D_MSWay_VariableDefine */
 
#if defined(__cplusplus)
extern "C"
{
#endif /* __cplusplus */
 
/********************************************************************************/
/**** If we are int MSWay.c file, then, create the structures and variables ****/
/********************************************************************************/
#if defined(D_MSWay_StructureDefine)
/*
 The MS for the ways only contains a dynamic array of way and the number of way in these array
 The effective structure containing information on ways are described in waypoint.h
*/
typedef struct tdstMSWay_
{
 WP_tdHandleOfGraph m_hPath ;	   /* path between two waypoints */
 long m_lIndex ;                   /* index on the current waypoint in the list */
 char m_bIsCircular;
} tdstMSWay;
#endif /* D_MSWay_StructureDefine */
 
/***********************/
/**** Handle define ****/
/***********************/
typedef struct tdstMSWay_ * MS_tdxHandleToMSWay;
 
/*
Misc definition :
*/
typedef unsigned char tduc_WayIndex;
 
/**** MSWay scripts ****/
#define C_SectionMSWayDescription                "MSWay"
#define C_EntryMSWayChamp                        "Champ"
 
/* Invalid MSWayHandle :*/
#define MSWAY_M_hInvalidMsWayHandle ((MS_tdxHandleToMSWay)NULL)
 
/**** Put here all globals variables : ****/
/****    EXTERN typeofvar  variable;   ****/
 
/*******************************/
/**** Base functions define ****/
/*******************************/
/*
------------------------------------------------------------------------------------------
MACROS-FUNCTIONS DECLARATION:
------------------------------------------------------------------------------------------
*/
/* */
/* accessing to the MSWay from the EngineObject :*/
#define MSWAY_M_hGetMSWayFromEngineObject(_EngineObject)\
 ((_EngineObject)->h_MSWay)
 
/*
-----------------------------------------------------------------------------------------
FUNCTIONS DECLARATION:
------------------------------------------------------------------------------------------
*/
#if !defined(U64)
extern CPA_EXPORT SCR_tde_Anl_ReturnValue fn_eMSWayScriptCallBack(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action	_eAction);
#endif /* U64 */
/*extern CPA_EXPORT void fn_vMSWaySaveMiniStructure(SCR_tdst_File_Description *p_stFile,struct tdstEngineObject_ *p_stObject);*/
extern CPA_EXPORT unsigned long fn_ulMSWaySizeOf();
extern CPA_EXPORT void fn_vMSWayAlloc(struct tdstEngineObject_ *p_stObject);
extern CPA_EXPORT MS_tdxHandleToMSWay fn_h_MSWayRealAlloc();
extern CPA_EXPORT void fn_vMSWayFree(struct tdstEngineObject_ *p_stObject);
extern CPA_EXPORT void fn_vMSWayInit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit);
extern CPA_EXPORT void fn_vMSWayDesinit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit);
extern CPA_EXPORT void fn_vMSWayCopyClone(struct tdstEngineObject_ * _p_stObjectDest,struct tdstEngineObject_ * _p_stObjectSrc);
 
extern CPA_EXPORT void fn_vWaypointSecondPass (void);
 
/*********************************/
/**** Misc functions define   ****/
/*********************************/
 
/*NZO 25/09/97*/
#ifdef BIN_SaveBin
extern CPA_EXPORT unsigned long MSWay_fn_ulWriteBinaryBloc(unsigned long _ulStructAddress, char* _p_cDestBuffer);
#endif
/*NZO 25/09/97*/
#ifdef BIN_LoadBin
extern CPA_EXPORT void MSWay_fn_vReadBinaryBloc(unsigned long _ulStructAddress, char* _p_cDestBuffer);
#endif
 
/*ANNECY JMD {*/
/*****************************************************************************
 * manage graph ( the m_hPath member )
 *****************************************************************************/
CPA_EXPORT void MSWay_fn_vInitPath (MS_tdxHandleToMSWay hWay) ;
CPA_EXPORT void MSWay_fn_vDesinitPath(MS_tdxHandleToMSWay hWay) ;
CPA_EXPORT void MSWay_fn_vSetPath(MS_tdxHandleToMSWay hWay, WP_tdHandleOfGraph hPath, char _bIsCircular);
CPA_EXPORT long MSWay_fn_lGetNumberWayPointInPath (MS_tdxHandleToMSWay hWay) ;
CPA_EXPORT long MSWay_fn_lGetCurrentIndexInPath (MS_tdxHandleToMSWay hWay) ;
CPA_EXPORT long MSWay_fn_lGetLastIndexInPath (MS_tdxHandleToMSWay hWay) ;
/*ANNECY Bart#01 13/02/98 {*/
CPA_EXPORT long MSWay_fn_lGetFirstIndexInPath (MS_tdxHandleToMSWay hWay);
CPA_EXPORT long MSWay_fn_lSetCurrentIndexInPath (MS_tdxHandleToMSWay hWay, long _lIndex);
/*ENDANNECY Bart#01 }*/
/*ANNECY Bart#02 24/02/98 {*/
CPA_EXPORT long MSWay_fn_lLookForWPInMSWay(MS_tdxHandleToMSWay _hWay, WP_tdhWayPoint _hWayPoint);
/*ENDANNECY Bart#02 }*/
CPA_EXPORT long MSWay_fn_lIncrementCurrentIndexInPath (MS_tdxHandleToMSWay hWay, int iIncrement) ;
CPA_EXPORT WP_tdhWayPoint MSWay_fn_hGetWayPointOfPath (MS_tdxHandleToMSWay hWay, int iIndex) ;
CPA_EXPORT WP_tdHandleOfGraph MSWay_fn_hGetPathFormPerso (HIE_tdxHandleToSuperObject hSuperObject) ;
 
/*ENDANNECY JMD }*/
 
CPA_EXPORT unsigned long MSWay_fn_ulGetCapsForNextWayPointOfPath (MS_tdxHandleToMSWay hWay, int iIndex) ;
CPA_EXPORT long MSWay_fn_lChangeCapsForNextWayPointOfPath (MS_tdxHandleToMSWay hWay, int iIndex, unsigned long ulNewCaps, long lValue) ;
CPA_EXPORT long MSWay_fn_lGetWeightForNextWayPointOfPath (MS_tdxHandleToMSWay hWay, int iIndex) ;
CPA_EXPORT long MSWay_fn_lChangeWeightForNextWayPointOfPath (MS_tdxHandleToMSWay hWay, int iIndex, long lWeight) ;
 
 
 
 
 
#if defined(__cplusplus)
}
#endif /* __cplusplus */
 
#endif /* __MSWay_H__ */
