// EdIRDat.cpp : implementation file
//

#include "stdafx.h"

#include "Defines.hpp"

#ifdef D_ED_IR_ACTIVE

#include "EdIRDat.hpp"

#include "EdIRWaW.hpp"
#include "EdIRIRD.hpp"
#include "EdIRBeEn.hpp"
#include "EdIRGlob.hpp"
#include "EdIR2Eng.hpp"
#include "EdIRStrg.hpp"

#include "EDACActr.hpp"
#include "EDACModl.hpp"
#include "_Actors.hpp"

#include "Ctl.h"
#include "WaW.h"

#include "x:\cpa\main\inc\_EditID.h"

#include "incAI.h"

#define C_OWNER_DATA_PARENT_ACTOR				"Data_Parent_Actor"
#define C_OWNER_DATA_IS_IN_WATCH				"Is In Watch"
//For array
#define C_OWNER_DATA_ASSOCIATED_CONTROL	"Associated Control"
#define C_OWNER_DATA_BASE_ADDRESS				"Base Address"
//For WAW
#define C_OWNER_DATA_WAW_DATA						"WaW Data"

/**********************************************************************************/
void fn_vDelete(CTL_Editor_Data *pclData)
{
	if(fn_bIsInWatch(pclData)==TRUE)
	{
		fn_vRemoveValueFromWatch(pclData);
	}

	delete pclData;
}

/**********************************************************************************/
void fn_vAddOwnerData(CTL_Editor_Data *pclData,EdActors_EditorActor *pclParentActor)
{
	pclData->m_pub_fn_pclAddOwnerData((void *)pclParentActor,C_OWNER_DATA_PARENT_ACTOR);
	pclData->m_pub_fn_pclAddOwnerData((long)FALSE,C_OWNER_DATA_IS_IN_WATCH);
	pclData->m_pub_fn_pclAddOwnerData((void *)NULL,C_OWNER_DATA_ASSOCIATED_CONTROL);
	pclData->m_pub_fn_pclAddOwnerData((void *)NULL,C_OWNER_DATA_BASE_ADDRESS);
	pclData->m_pub_fn_pclAddOwnerData((void *)NULL,C_OWNER_DATA_WAW_DATA);
}

/**********************************************************************************/
EdActors_EditorActor *fn_pclGetParentActor(CTL_Editor_Data *pclData)
{
	CTL_OwnerData *pclOwnerData=pclData->m_pub_fn_pclGetOwnerDataWithName(C_OWNER_DATA_PARENT_ACTOR);
	if(pclOwnerData!=NULL)
		return (EdActors_EditorActor *)(pclOwnerData->m_pub_fn_pvGetDataPtr());
	else
		return NULL;
}

/**********************************************************************************/
BOOL fn_bIsInWatch(CTL_Editor_Data *pclData)
{
	CTL_OwnerData *pclOwnerData=pclData->m_pub_fn_pclGetOwnerDataWithName(C_OWNER_DATA_IS_IN_WATCH);
	if(pclOwnerData!=NULL)
		return (BOOL)(pclOwnerData->m_pub_fn_lGetData());
	else
		return FALSE;
}

/**********************************************************************************/
void fn_vSetInWatch(CTL_Editor_Data *pclData,BOOL bInWatch)
{
	CTL_OwnerData *pclOwnerData=pclData->m_pub_fn_pclGetOwnerDataWithName(C_OWNER_DATA_IS_IN_WATCH);
	if(pclOwnerData!=NULL)
		pclOwnerData->m_pub_fn_vSetData((long)bInWatch);
}

/**********************************************************************************/
WAW_Data *fn_pclGetWatchData(CTL_Editor_Data *pclData)
{
	CTL_OwnerData *pclOwnerData=pclData->m_pub_fn_pclGetOwnerDataWithName(C_OWNER_DATA_WAW_DATA);
	if(pclOwnerData!=NULL)
		return (WAW_Data *)(pclOwnerData->m_pub_fn_pvGetDataPtr());
	else
		return NULL;
}

/**********************************************************************************/
void fn_vSetWatchData(CTL_Editor_Data *pclData,WAW_Data *pclWatchData)
{
	CTL_OwnerData *pclOwnerData=pclData->m_pub_fn_pclGetOwnerDataWithName(C_OWNER_DATA_WAW_DATA);
	if(pclOwnerData!=NULL)
		pclOwnerData->m_pub_fn_vSetDataPtr((void *)pclWatchData);
}

/**********************************************************************************/
CTL_Editor_Control *fn_pclGetAssociatedControl(CTL_Editor_Data *pclData)
{
	CTL_OwnerData *pclOwnerData=pclData->m_pub_fn_pclGetOwnerDataWithName(C_OWNER_DATA_ASSOCIATED_CONTROL);
	if(pclOwnerData!=NULL)
		return (CTL_Editor_Control *)(pclOwnerData->m_pub_fn_pvGetDataPtr());
	else
		return NULL;
}

/**********************************************************************************/
void fn_vSetAssociatedControl(CTL_Editor_Data *pclData,CTL_Editor_Control *pclAssociatedControl)
{
	CTL_OwnerData *pclOwnerData=pclData->m_pub_fn_pclGetOwnerDataWithName(C_OWNER_DATA_ASSOCIATED_CONTROL);
	if(pclOwnerData!=NULL)
		pclOwnerData->m_pub_fn_vSetDataPtr((void *)pclAssociatedControl);
}

/**********************************************************************************/
void *fn_pvGetBaseAddress(CTL_Editor_Data *pclData)
{
	CTL_OwnerData *pclOwnerData=pclData->m_pub_fn_pclGetOwnerDataWithName(C_OWNER_DATA_BASE_ADDRESS);
	if(pclOwnerData!=NULL)
		return pclOwnerData->m_pub_fn_pvGetDataPtr();
	else
		return NULL;
}

/**********************************************************************************/
void fn_vSetBaseAddress(CTL_Editor_Data *pclData,void *pvBaseAddress)
{
	CTL_OwnerData *pclOwnerData=pclData->m_pub_fn_pclGetOwnerDataWithName(C_OWNER_DATA_BASE_ADDRESS);
	if(pclOwnerData!=NULL)
		pclOwnerData->m_pub_fn_vSetDataPtr(pvBaseAddress);
}

/**********************************************************************************/
void fn_vIndexHasChanged(CTL_Editor_Data *pclDataBase,enum CTL_eUpdateReason eReason,long)
{
	if(eReason==CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER)
	{
		//Gets associated control
		CTL_Editor_Control	*pclArrayControl=fn_pclGetAssociatedControl(pclDataBase);

		if(pclArrayControl!=NULL)
		{
			//Gets associated data
			CTL_Editor_Data	*pclArrayData=pclArrayControl->m_fn_pclGetEditedData();

			if(pclArrayData!=NULL)
			{
				//Gets selected index
				ASSERT(pclDataBase->m_pub_fn_tdeGetDataType()==CTL_DATA_TYPE__INTEGER);
				CTL_Editor_IntegerData	*pclIndexData=(CTL_Editor_IntegerData *)pclDataBase;
				long										lIndex=pclIndexData->m_lCurrentValue;

				//Gets base address of the array
				void	*pvBaseAddress=fn_pvGetBaseAddress(pclArrayData);
				if(pvBaseAddress!=NULL)
				{
					tdstArray	*pstArray=(tdstArray *)pvBaseAddress;
					pclArrayData->m_fn_vSetMotorDataPtr(M_ARRAY_ELEMENT(pstArray,lIndex));
					pclArrayData->m_fn_vGetMotorData();
					pclArrayControl->m_fn_vUpdate();
				}
				else
				{
					ASSERT(FALSE);
				}
			}
			else
			{
				ASSERT(FALSE);
			}
		}
		else
		{
			ASSERT(FALSE);
		}
	}
}

/****************************************************************************/
void fn_vNotifyInitialValue(CTL_Editor_Data *pclDataBase,CTL_tdeUpdateReason eReason,long)
{
	if(eReason==CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER)
	{
		//Gets parent for this data
		EdActors_EditorActor	*pclParentActor=fn_pclGetParentActor(pclDataBase);
		CPA_Actor							*pclActor=pclParentActor->m_pclActor;

// Shaitan => Check Save type
		
		// check for save type
		if (pclDataBase->m_pub_fn_csGetDataName().Find(g_c_csDsgVarSaveTypeText)!= -1)
		{
			// the actor is a model, but check anyway
			if (!pclActor->m_fn_bIsAnInstance())
			{
				EdActors_EditorActorModel	*pclModel	= (EdActors_EditorActorModel *)(pclActor->m_fn_pclGetEditorActor());
				POSITION					pos			= pclModel->m_clInstancesList.GetHeadPosition();
				BOOL						bAlways		= FALSE;
				BOOL						bCommon		= TRUE;
				while (pos)
				{
					EdActors_EditorActorInstance *pclInstance = pclModel->m_clInstancesList.GetNext(pos);
					// an always must have no save type
					if (pclInstance->m_pclActor->m_fn_bIsAnAlways())
						bAlways = TRUE;
					// a level actor can have only "level" or "non" save type
					else if (!pclInstance->m_pclActor->m_pub_fn_bIsCommon())
						bCommon = FALSE;
				}

				if (bAlways)
				{
					CTL_Editor_EnumData *pData = (CTL_Editor_EnumData *) pclDataBase;
					if (pData->m_pclCurrentValue->m_pub_fn_lGetValue() != 0)
					{
						MessageBox(NULL,  "An always must not use any Save Type !!", "WARNING SAVE TYPE", MB_ICONEXCLAMATION);
						pData->m_pclCurrentValue = pData->m_fn_pclGetEnumDescriptor()->GetHead();
						pData->m_fn_vUpdateMotorData(eReason);
						pData->m_pub_fn_pclGetParentControl()->m_fn_vUpdate();
					}

				}
				// a level actor can have only "level" or "non" save type
				else if (!bCommon)
				{
					CTL_Editor_EnumData *pData = (CTL_Editor_EnumData *) pclDataBase;
					if (pData->m_pclCurrentValue->m_pub_fn_lGetValue() == SAI_ePlayerSaveCurrentValue)
					{
						int iRes = MessageBox(NULL,  "This Save Type must be used only be the actors in fix !!\n Are you sure you want to keep this value ?", "WARNING SAVE TYPE", MB_ICONEXCLAMATION | MB_YESNO );
						if (iRes == IDNO)
						{
							pData->m_pclCurrentValue = pData->m_pclOldValue;
							pData->m_fn_vUpdateMotorData(eReason);
							pData->m_pub_fn_pclGetParentControl()->m_fn_vUpdate();
						}
					}
				}
			}
		}
// End Shaitan => Check Save type		

		if(pclActor->m_fn_bIsAnInstance())
		{
			pclActor->fn_vNotifySave();
		}
		else
		{
			EdActors_EditorActorModel *pclModel=(EdActors_EditorActorModel *)(pclActor->m_fn_pclGetEditorActor());
			CPA_EdIR_Brain						*pclBrain=pclModel->m_pclBrain;

			pclBrain->m_fn_vSetModified(TRUE);

// Shaitan => Check Save type
			if (pclDataBase->m_pub_fn_csGetDataName().Find(g_c_csDsgVarSaveTypeText) != -1)
			{
				COLORREF rBackGround = ((CTL_Editor_EnumData *)pclDataBase)->m_pclCurrentValue->m_pub_fn_lGetValue() ? RGB(255,100,200) : RGB(0,255,255);
				pclDataBase->m_pub_fn_pclGetParentControl()->m_pub_fn_pclGetNameStatic()->m_pub_fn_vSetBackGroundColor(rBackGround, TRUE);
			}
			else if (pclDataBase->m_pub_fn_csGetDataName().Find(g_c_csDsgVarInitTypeText)!= -1)
			{
				COLORREF rBackGround = (((CTL_Editor_EnumData *)pclDataBase)->m_pclCurrentValue->m_pub_fn_lGetValue() != OTI_PlayerDead) ? RGB(255,100,0) : RGB(255,255,0);
				pclDataBase->m_pub_fn_pclGetParentControl()->m_pub_fn_pclGetNameStatic()->m_pub_fn_vSetBackGroundColor(rBackGround, TRUE);
			}
// End Shaitan => Check Save type		
		}
	}
}

/*************************************************************************/
//return pointer in pcslValues
void fn_vGetLowInfoAboutDsgVar(CTL_Editor_Data *pclData,
															 CString					&csName,
															 CString					&csType,
															 CStringList			*pcslValues)
{
	//Updates data
	pclData->m_fn_vGetMotorData();

	//Gets Name
	csName=pclData->m_pub_fn_csGetDataName();

	//Tests if pclData is an array
	void	*pvBaseAddress=fn_pvGetBaseAddress(pclData);
	if(pvBaseAddress!=NULL)
	{
		tdstArray				*pstArray=(tdstArray *)pvBaseAddress;
		long						lNbElt=M_ARRAY_SIZE(pstArray);
		CString					csValue;
		tdstGetSetParam stGetSetParam;
		switch(pclData->m_pub_fn_tdeGetDataType())
		{
			case CTL_DATA_TYPE__INTEGER:
			{
				ASSERT(M_ARRAY_TYPE(pstArray)==eDsgVarType_Integer);

				for(long lIndex=0;lIndex<lNbElt;lIndex++)
				{
					fn_ucGetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);
					csValue.Format("%ld",M_GetSetParam_lValue(&stGetSetParam));

					pcslValues->AddTail(csValue);
				}

				csType=g_c_csInteger;
			}
			break;

			case CTL_DATA_TYPE__DECIMAL:
			{
				ASSERT(M_ARRAY_TYPE(pstArray)==eDsgVarType_Float);

				for(long lIndex=0;lIndex<lNbElt;lIndex++)
				{
					fn_ucGetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);
					csValue.Format("%f",M_GetSetParam_xValue(&stGetSetParam));

					pcslValues->AddTail(csValue);
				}

				csType=g_c_csDecimal;
			}
			break;

			case CTL_DATA_TYPE__ENUM:
			{
				ASSERT((M_ARRAY_TYPE(pstArray)==eDsgVarType_Perso) ||
							 (M_ARRAY_TYPE(pstArray)==eDsgVarType_WayPoint) ||
							 (M_ARRAY_TYPE(pstArray)==eDsgVarType_Text));

				for(long lIndex=0;lIndex<lNbElt;lIndex++)
				{
					fn_ucGetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);

					if(M_ARRAY_TYPE(pstArray)==eDsgVarType_Perso)
						csValue.Format("%ld",M_GetSetParam_lValue(&stGetSetParam));
					else
					if(M_ARRAY_TYPE(pstArray)==eDsgVarType_WayPoint)
						csValue.Format("%ld",M_GetSetParam_WayPointValue(&stGetSetParam));
					else
					if(M_ARRAY_TYPE(pstArray)==eDsgVarType_Text)
						csValue.Format("%ld",M_GetSetParam_hText(&stGetSetParam));

					pcslValues->AddTail(csValue);
				}

				csType=g_c_csEnum;
			}
			break;

			case CTL_DATA_TYPE__VECTOR:
			{
				ASSERT(M_ARRAY_TYPE(pstArray)==eDsgVarType_Vector);

				for(long lIndex=0;lIndex<lNbElt;lIndex++)
				{
					fn_ucGetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);

					MTH3D_tdstVector	*pstVector=&(M_GetSetParam_stVertexValue(&stGetSetParam));
					csValue.Format("%f,%f,%f",
												 MTH3D_M_xGetXofVector(pstVector),
												 MTH3D_M_xGetYofVector(pstVector),
												 MTH3D_M_xGetZofVector(pstVector));

					pcslValues->AddTail(csValue);
				}

				csType=g_c_csVector;
			}
			break;

			default:
			{
				AfxMessageBox("Pb with GetInfoAboutDsgVar");
			}
		}
	}
	else
	{
		CString	csValue;

		switch(pclData->m_pub_fn_tdeGetDataType())
		{
			case CTL_DATA_TYPE__INTEGER:
			{
				CTL_Editor_IntegerData	*pclDataInteger=(CTL_Editor_IntegerData *)pclData;
				csValue.Format("%ld",pclDataInteger->m_lCurrentValue);
				csType=g_c_csInteger;
			}
			break;

			case CTL_DATA_TYPE__DECIMAL:
			{
				CTL_Editor_DecimalData	*pclDataDecimal=(CTL_Editor_DecimalData *)pclData;
				csValue.Format("%f",pclDataDecimal->m_ldCurrentValue);
				csType=g_c_csDecimal;
			}
			break;

			case CTL_DATA_TYPE__BOOLEAN:
			{
				CTL_Editor_BooleanData	*pclDataBoolean=(CTL_Editor_BooleanData *)pclData;
				if(pclDataBoolean->m_bCurrentState==TRUE)
					csValue=g_c_csTrue;
				else
					csValue=g_c_csFalse;
				csType=g_c_csBoolean;
			}
			break;

			case CTL_DATA_TYPE__ENUM:
			{
				CTL_Editor_EnumData	*pclDataEnum=(CTL_Editor_EnumData *)pclData;
				if(pclDataEnum->m_pclCurrentValue!=NULL)
					csValue.Format("%ld",pclDataEnum->m_pclCurrentValue->m_pub_fn_lGetValue());
				else
				{
					AfxMessageBox("Pb with GetInfoAboutDsgVar : Enum control with current value NULL !!");
					csValue="";
				}
				csType=g_c_csEnum;
			}
			break;

			case CTL_DATA_TYPE__TEXT:
			{
				CTL_Editor_TextData	*pclDataText=(CTL_Editor_TextData *)pclData;
				csValue=pclDataText->m_csCurrentString;
				csType=g_c_csText;
			}
			break;

			case CTL_DATA_TYPE__VECTOR:
			{
				CTL_Editor_VectorData	*pclDataVector=(CTL_Editor_VectorData *)pclData;
				csValue.Format("%f,%f,%f",
											 pclDataVector->m_ldCurrentValueX,
											 pclDataVector->m_ldCurrentValueY,
											 pclDataVector->m_ldCurrentValueZ);
				csType=g_c_csVector;
			}
			break;

//ANNECY Bart#02 24/04/98 {
      case CTL_DATA_TYPE__MASKED:
      {
				CTL_Editor_MaskedData* pclDataMask=(CTL_Editor_MaskedData* )pclData;
				csValue.Format("%uld",pclDataMask->m_ulCurrentValue);
				csType = g_c_csInteger; // ?
      }
      break;
//ENDANNECY Bart#02 }

	  // BEGIN ROMTEAM Cristi Petrescu 98-11-
	  // shouldn't we use m_fn_pcslFormatDataValueString ?!!!!
	  // another example of poor design. we cannot use it because cannot compile for the enums...
	  // maybe define a new call back?!
	  // or use the control call back?! - who cares, it's only used here.
	  case CTL_DATA_TYPE__ARRAY:
		{
			CTL_Editor_ArrayData *pclArrayData;
			pclArrayData = (CTL_Editor_ArrayData *) pclData;
			CTL_Editor_Control *pclControl;
			pclControl = pclArrayData -> m_pub_fn_pclGetParentControl ();
			tdstArray		*pstArray;
			pstArray = (tdstArray *) pclArrayData -> m_pub_fn_pvGetMotorData ();
			long			lNbElt;
			lNbElt=M_ARRAY_SIZE(pstArray);
			if (lNbElt == 0)
				break;
			tdstGetSetParam	stGetSetParam;

			switch (pclControl -> m_pub_fn_tdeGetDataType ())
			{
			case CTL_DATA_TYPE__ARRAY_ENUM:
				{
					ASSERT((M_ARRAY_TYPE(pstArray)==eDsgVarType_Perso) ||
								 (M_ARRAY_TYPE(pstArray)==eDsgVarType_WayPoint) ||
								 (M_ARRAY_TYPE(pstArray)==eDsgVarType_Text));

					for(long lIndex=0;lIndex<lNbElt;lIndex++)
					{
						fn_ucGetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);

						if(M_ARRAY_TYPE(pstArray)==eDsgVarType_Perso)
							csValue.Format("%ld",M_GetSetParam_lValue(&stGetSetParam));
						else
						if(M_ARRAY_TYPE(pstArray)==eDsgVarType_WayPoint)
							csValue.Format("%ld",M_GetSetParam_WayPointValue(&stGetSetParam));
						else
						if(M_ARRAY_TYPE(pstArray)==eDsgVarType_Text)
							csValue.Format("%ld",M_GetSetParam_hText(&stGetSetParam));

						pcslValues->AddTail(csValue);
					}
					csType=g_c_csEnum;
				}
				break;

			case CTL_DATA_TYPE__ARRAY_VECTOR:
				{
					ASSERT(M_ARRAY_TYPE(pstArray)==eDsgVarType_Vector);

					for(long lIndex=0;lIndex<lNbElt;lIndex++)
					{
						fn_ucGetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);

						MTH3D_tdstVector	*pstVector=&(M_GetSetParam_stVertexValue(&stGetSetParam));
						csValue.Format("%f,%f,%f",
													 MTH3D_M_xGetXofVector(pstVector),
													 MTH3D_M_xGetYofVector(pstVector),
													 MTH3D_M_xGetZofVector(pstVector));

						pcslValues->AddTail(csValue);
					}

					csType=g_c_csVector;
				}
				break;

			case CTL_DATA_TYPE__ARRAY_DECIMAL:
				{
					ASSERT(M_ARRAY_TYPE(pstArray)==eDsgVarType_Float);

					for(long lIndex=0;lIndex<lNbElt;lIndex++)
					{
						fn_ucGetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);
						csValue.Format("%f",M_GetSetParam_xValue(&stGetSetParam));

						pcslValues->AddTail(csValue);
					}

					csType=g_c_csDecimal;
				}
				break;
			case CTL_DATA_TYPE__ARRAY_INTEGER:
				{
					ASSERT(M_ARRAY_TYPE(pstArray)==eDsgVarType_Integer);

					for(long lIndex=0;lIndex<lNbElt;lIndex++)
					{
						fn_ucGetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);
						csValue.Format("%ld",M_GetSetParam_lValue(&stGetSetParam));

						pcslValues->AddTail(csValue);
					}

					csType=g_c_csInteger;
				}

				break;

			default:
				{
					AfxMessageBox("Pb with GetInfoAboutDsgVar - array");
				}
			}
		}
		break;
		// END ROMTEAM Cristi Petrescu 98-11-

			default:
			{
				AfxMessageBox("Pb with GetInfoAboutDsgVar");
			}
		}

		if (pclData->m_pub_fn_tdeGetDataType()  != CTL_DATA_TYPE__ARRAY)
			pcslValues->AddTail(csValue);
	}
}

/*************************************************************************/
//return name object in pcslValues
void fn_vGetInfoAboutDsgVar(CTL_Editor_Data *pclData,
														CString					&csName,
														CString					&csType,
														CStringList			*pcslValues)
{
	//Updates data
	pclData->m_fn_vGetMotorData();

	//Gets Name
	csName=pclData->m_pub_fn_csGetDataName();

	//Tests if pclData is an array
	void	*pvBaseAddress=fn_pvGetBaseAddress(pclData);
	if(pvBaseAddress!=NULL)
	{
		tdstArray				*pstArray=(tdstArray *)pvBaseAddress;
		long						lNbElt=M_ARRAY_SIZE(pstArray);
		CString					csValue;
		tdstGetSetParam stGetSetParam;
		switch(pclData->m_pub_fn_tdeGetDataType())
		{
			case CTL_DATA_TYPE__INTEGER:
			{
				ASSERT(M_ARRAY_TYPE(pstArray)==eDsgVarType_Integer);

				for(long lIndex=0;lIndex<lNbElt;lIndex++)
				{
					fn_ucGetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);
					csValue.Format("%ld",M_GetSetParam_lValue(&stGetSetParam));

					pcslValues->AddTail(csValue);
				}

				csType=g_c_csInteger;
			}
			break;

			case CTL_DATA_TYPE__DECIMAL:
			{
				ASSERT(M_ARRAY_TYPE(pstArray)==eDsgVarType_Float);

				for(long lIndex=0;lIndex<lNbElt;lIndex++)
				{
					fn_ucGetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);
					csValue.Format("%f",M_GetSetParam_xValue(&stGetSetParam));

					pcslValues->AddTail(csValue);
				}

				csType=g_c_csDecimal;
			}
			break;

			case CTL_DATA_TYPE__ENUM:
			{
				ASSERT((M_ARRAY_TYPE(pstArray)==eDsgVarType_Perso) ||
							 (M_ARRAY_TYPE(pstArray)==eDsgVarType_WayPoint) ||
							 (M_ARRAY_TYPE(pstArray)==eDsgVarType_Text));

				for(long lIndex=0;lIndex<lNbElt;lIndex++)
				{
					fn_ucGetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);

					//Persos
					if(M_ARRAY_TYPE(pstArray)==eDsgVarType_Perso)
					{
						long		lHandle=M_GetSetParam_lValue(&stGetSetParam);
						CString	csReferencedSectionName;
						if(lHandle!=NULL)
						{
							CPA_SaveObject	*pclObject=fn_pclGetReachableObject(lHandle,C_szActorInstanceTypeName);
							csValue=(pclObject) ? pclObject->GetName() : "Unknown";
						}
						else
							csValue=szFindKeyWordScriptNameFromId(eKeyWord_Nobody);
					}
					else
					//SuperObject
					if(M_ARRAY_TYPE(pstArray)==eDsgVarType_SuperObject)
					{
						long		lHandle=M_GetSetParam_lValue(&stGetSetParam);
						CString	csReferencedSectionName;
						if(lHandle!=NULL)
						{
							CPA_SaveObject	*pclObject=fn_pclGetReachableObject(lHandle,C_szSuperObjectTypeName);
							csValue=(pclObject) ? pclObject->GetName() : "Unknown";
						}
						else
							csValue=szFindKeyWordScriptNameFromId(eKeyWord_NoSuperObject);
					}
					//Waypoints
					if(M_ARRAY_TYPE(pstArray)==eDsgVarType_WayPoint)
					{
						long		lHandle=(long)M_GetSetParam_WayPointValue(&stGetSetParam);
						if(lHandle!=NULL)
						{
							CPA_SaveObject	*pclObject=fn_pclGetReachableObject(lHandle,C_szWayPointTypeName);
							csValue=(pclObject) ? pclObject->GetName() : "Unknown";
						}
						else
							csValue=szFindKeyWordScriptNameFromId(eKeyWord_Nowhere);
					}
  				    else
				    //Texts
				    if(M_ARRAY_TYPE(pstArray)==eDsgVarType_Text)
					{
						FON_tdxHandleOfText hText = M_GetSetParam_hText(&stGetSetParam);

						csValue = FON_fn_szGetNameOfTextHandle(hText);
					}

					pcslValues->AddTail(csValue);
				}

				csType=g_c_csEnum;
			}
			break;

			case CTL_DATA_TYPE__VECTOR:
			{
				ASSERT(M_ARRAY_TYPE(pstArray)==eDsgVarType_Vector);

				for(long lIndex=0;lIndex<lNbElt;lIndex++)
				{
					fn_ucGetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);

					MTH3D_tdstVector	*pstVector=&(M_GetSetParam_stVertexValue(&stGetSetParam));
					csValue.Format("%f,%f,%f",
												 MTH3D_M_xGetXofVector(pstVector),
												 MTH3D_M_xGetYofVector(pstVector),
												 MTH3D_M_xGetZofVector(pstVector));

					pcslValues->AddTail(csValue);
				}

				csType=g_c_csVector;
			}
			break;

			default:
			{
				AfxMessageBox("Pb with EdIRDat::fn_vGetInfoAboutDsgVar");

				ASSERT(FALSE);
			}
		}
	}
	else
	{
		CString	csValue;

		switch(pclData->m_pub_fn_tdeGetDataType())
		{
			case CTL_DATA_TYPE__INTEGER:
			{
				CTL_Editor_IntegerData	*pclDataInteger=(CTL_Editor_IntegerData *)pclData;
				csValue.Format("%ld",pclDataInteger->m_lCurrentValue);
				csType=g_c_csInteger;
			}
			break;

			case CTL_DATA_TYPE__DECIMAL:
			{
				CTL_Editor_DecimalData	*pclDataDecimal=(CTL_Editor_DecimalData *)pclData;
				csValue.Format("%f",pclDataDecimal->m_ldCurrentValue);
				csType=g_c_csDecimal;
			}
			break;

			case CTL_DATA_TYPE__BOOLEAN:
			{
				CTL_Editor_BooleanData	*pclDataBoolean=(CTL_Editor_BooleanData *)pclData;
				if(pclDataBoolean->m_bCurrentState==TRUE)
					csValue=g_c_csTrue;
				else
					csValue=g_c_csFalse;
				csType=g_c_csBoolean;
			}
			break;

			case CTL_DATA_TYPE__ENUM:
			{
				CTL_Editor_EnumData	*pclDataEnum=(CTL_Editor_EnumData *)pclData;
				if(pclDataEnum->m_pclCurrentValue!=NULL)
					csValue=pclDataEnum->m_fn_pcslFormatDataValueString()->GetHead();
				else
				{
					AfxMessageBox("Pb with EdIRDat::fn_vGetInfoAboutDsgVar : Enum control with current value NULL !!");
					csValue="";

					ASSERT(FALSE);
				}
				csType=g_c_csEnum;
			}
			break;

			case CTL_DATA_TYPE__TEXT:
			{
				CTL_Editor_TextData	*pclDataText=(CTL_Editor_TextData *)pclData;
				csValue=pclDataText->m_csCurrentString;
				csType=g_c_csText;
			}
			break;

			case CTL_DATA_TYPE__VECTOR:
			{
				CTL_Editor_VectorData	*pclDataVector=(CTL_Editor_VectorData *)pclData;
				csValue.Format("%f,%f,%f",
											 pclDataVector->m_ldCurrentValueX,
											 pclDataVector->m_ldCurrentValueY,
											 pclDataVector->m_ldCurrentValueZ);
				csType=g_c_csVector;
			}
			break;

//ANNECY Bart#02 24/04/98 {
      case CTL_DATA_TYPE__MASKED:
      {
				CTL_Editor_MaskedData* pclDataMask=(CTL_Editor_MaskedData* )pclData;
				csValue.Format("%uld",pclDataMask->m_ulCurrentValue);
				csType = g_c_csInteger; // ?
      }
			break;
//ENDANNECY Bart#02 }

			// BEGIN ROMTEAM Cristi Petrescu 98-11-
	  // shouldn't we use m_fn_pcslFormatDataValueString ?!!!!
	  // another example of poor design. we cannot use it because cannot compile for the enums...
	  // maybe define a new call back?!
	  // or use the control call back?! - who cares, it's only used here.
	  case CTL_DATA_TYPE__ARRAY:
		{
			CTL_Editor_ArrayData *pclArrayData;
			pclArrayData = (CTL_Editor_ArrayData *) pclData;
			CTL_Editor_Control *pclControl;
			pclControl = pclArrayData -> m_pub_fn_pclGetParentControl ();
			tdstArray		*pstArray;
			pstArray = (tdstArray *) pclArrayData -> m_pub_fn_pvGetMotorData ();
			long			lNbElt;
			lNbElt=M_ARRAY_SIZE(pstArray);
			if (lNbElt == 0)
				break;
			tdstGetSetParam	stGetSetParam;

			switch (pclControl -> m_pub_fn_tdeGetDataType ())
			{
			case CTL_DATA_TYPE__ARRAY_ENUM:
				{
					ASSERT((M_ARRAY_TYPE(pstArray)==eDsgVarType_Perso) ||
								 (M_ARRAY_TYPE(pstArray)==eDsgVarType_WayPoint) ||
								 (M_ARRAY_TYPE(pstArray)==eDsgVarType_Text));

					for(long lIndex=0;lIndex<lNbElt;lIndex++)
					{
						fn_ucGetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);

						//Persos
						if(M_ARRAY_TYPE(pstArray)==eDsgVarType_Perso)
						{
							long		lHandle=M_GetSetParam_lValue(&stGetSetParam);
							CString	csReferencedSectionName;
							if(lHandle!=NULL)
							{
								CPA_SaveObject	*pclObject=fn_pclGetReachableObject(lHandle,C_szActorInstanceTypeName);
								csValue=(pclObject) ? pclObject->GetName() : "Unknown";
							}
							else
								csValue=szFindKeyWordScriptNameFromId(eKeyWord_Nobody);
						}
						else
						//Waypoints
						if(M_ARRAY_TYPE(pstArray)==eDsgVarType_WayPoint)
						{
							long		lHandle=(long)M_GetSetParam_WayPointValue(&stGetSetParam);
							if(lHandle!=NULL)
							{
								CPA_SaveObject	*pclObject=fn_pclGetReachableObject(lHandle,C_szWayPointTypeName);
								csValue=(pclObject) ? pclObject->GetName() : "Unknown";
							}
							else
								csValue=szFindKeyWordScriptNameFromId(eKeyWord_Nowhere);
						}
			  else
			  //Texts
			  if(M_ARRAY_TYPE(pstArray)==eDsgVarType_Text)
			  {
				FON_tdxHandleOfText hText = M_GetSetParam_hText(&stGetSetParam);

				csValue = FON_fn_szGetNameOfTextHandle(hText);
			  }

						pcslValues->AddTail(csValue);
					}

					csType=g_c_csEnum;
				}
				break;

			case CTL_DATA_TYPE__ARRAY_VECTOR:
				{
					ASSERT(M_ARRAY_TYPE(pstArray)==eDsgVarType_Vector);

					for(long lIndex=0;lIndex<lNbElt;lIndex++)
					{
						fn_ucGetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);

						MTH3D_tdstVector	*pstVector=&(M_GetSetParam_stVertexValue(&stGetSetParam));
						csValue.Format("%f,%f,%f",
													 MTH3D_M_xGetXofVector(pstVector),
													 MTH3D_M_xGetYofVector(pstVector),
													 MTH3D_M_xGetZofVector(pstVector));

						pcslValues->AddTail(csValue);
					}

					csType=g_c_csVector;
				}
				break;

			case CTL_DATA_TYPE__ARRAY_DECIMAL:
				{
					ASSERT(M_ARRAY_TYPE(pstArray)==eDsgVarType_Float);

					for(long lIndex=0;lIndex<lNbElt;lIndex++)
					{
						fn_ucGetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);
						csValue.Format("%f",M_GetSetParam_xValue(&stGetSetParam));

						pcslValues->AddTail(csValue);
					}

					csType=g_c_csDecimal;
				}
				break;
			case CTL_DATA_TYPE__ARRAY_INTEGER:
				{
					ASSERT(M_ARRAY_TYPE(pstArray)==eDsgVarType_Integer);

					for(long lIndex=0;lIndex<lNbElt;lIndex++)
					{
						fn_ucGetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);
						csValue.Format("%ld",M_GetSetParam_lValue(&stGetSetParam));

						pcslValues->AddTail(csValue);
					}

					csType=g_c_csInteger;
				}

				break;

			default:
				{
					AfxMessageBox("Pb with EdIRDat::fn_vGetInfoAboutDsgVar - array");
				}
			}
		}
		break;
		// END ROMTEAM Cristi Petrescu 98-11-

      default:
			{
				AfxMessageBox("Pb with EdIRDat::fn_vGetInfoAboutDsgVar");

				ASSERT(FALSE);
			}
		}

		if (pclData->m_pub_fn_tdeGetDataType()  != CTL_DATA_TYPE__ARRAY)
			pcslValues->AddTail(csValue);
	}
}

/*************************************************************************/
void fn_vSetValueInDsgVar(CTL_Editor_Data *pclData,CStringList *pcslValues,void *pvEngineData)
{
	//Tests if pclData is an array
	void	*pvBaseAddress=fn_pvGetBaseAddress(pclData);
	if(pvBaseAddress!=NULL)
	{
		tdstArray				*pstArray=(tdstArray *)pvBaseAddress;
		long						lNbElt=M_ARRAY_SIZE(pstArray);

		CString					csValue;
		tdstGetSetParam stGetSetParam;
		switch(pclData->m_pub_fn_tdeGetDataType())
		{
			case CTL_DATA_TYPE__INTEGER:
			{
				ASSERT(M_ARRAY_TYPE(pstArray)==eDsgVarType_Integer);

				POSITION	pos=pcslValues->GetHeadPosition();
				long			lIndex=0;
				while(pos!=NULL && lIndex<lNbElt)
				{
					csValue=pcslValues->GetNext(pos);
					M_GetSetParam_lValue(&stGetSetParam)=atol(M_MAKECHAR(csValue));

					fn_ucSetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);

					lIndex++;
				}
			}
			break;

			case CTL_DATA_TYPE__DECIMAL:
			{
				ASSERT(M_ARRAY_TYPE(pstArray)==eDsgVarType_Float);

				POSITION	pos=pcslValues->GetHeadPosition();
				long			lIndex=0;
				while(pos!=NULL && lIndex<lNbElt)
				{
					csValue=pcslValues->GetNext(pos);
					M_GetSetParam_xValue(&stGetSetParam)=(MTH_tdxReal)atof(M_MAKECHAR(csValue));
					M_GetSetParam_Type(&stGetSetParam) = E_vt_Float;

					fn_ucSetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);

					lIndex++;
				}
			}
			break;

			case CTL_DATA_TYPE__ENUM:
			{
				ASSERT((M_ARRAY_TYPE(pstArray)==eDsgVarType_Perso) ||
							 (M_ARRAY_TYPE(pstArray)==eDsgVarType_WayPoint) ||
							 (M_ARRAY_TYPE(pstArray)==eDsgVarType_Text));

				POSITION	pos=pcslValues->GetHeadPosition();
				long			lIndex=0;
				while(pos!=NULL && lIndex<lNbElt)
				{
					csValue=pcslValues->GetNext(pos);
					if(M_ARRAY_TYPE(pstArray)==eDsgVarType_Perso)
						M_GetSetParam_lValue(&stGetSetParam) = atol(M_MAKECHAR(csValue));
					else
					if(M_ARRAY_TYPE(pstArray)==eDsgVarType_WayPoint)
						M_GetSetParam_WayPointValue(&stGetSetParam) = (struct WP_tdstWayPoint_ *)atol(M_MAKECHAR(csValue));
					else
					if(M_ARRAY_TYPE(pstArray)==eDsgVarType_Text)
						M_GetSetParam_hText(&stGetSetParam) = (FON_tdxHandleOfText) atol(M_MAKECHAR(csValue));

					fn_ucSetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);

					lIndex++;
				}
			}
			break;

			case CTL_DATA_TYPE__VECTOR:
			{
				ASSERT(M_ARRAY_TYPE(pstArray)==eDsgVarType_Vector);

				POSITION	pos=pcslValues->GetHeadPosition();
				long			lIndex=0;
				while(pos!=NULL && lIndex<lNbElt)
				{
					csValue=pcslValues->GetNext(pos);
					long		lTmpIndex=0;
					CString	csX=fn_csGetNextWord(csValue,lTmpIndex);
					CString	csY=fn_csGetNextWord(csValue,lTmpIndex);
					CString	csZ=fn_csGetNextWord(csValue,lTmpIndex);

					MTH3D_tdstVector	*pstVector=&(M_GetSetParam_stVertexValue(&stGetSetParam));
					MTH3D_M_xGetXofVector(pstVector)=(MTH_tdxReal)atof(M_MAKECHAR(csX));
					MTH3D_M_xGetYofVector(pstVector)=(MTH_tdxReal)atof(M_MAKECHAR(csY));
					MTH3D_M_xGetZofVector(pstVector)=(MTH_tdxReal)atof(M_MAKECHAR(csZ));

					fn_ucSetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);

					lIndex++;
				}
			}
			break;

			default:
			{
				AfxMessageBox("Pb with SetValueInDsgVar");
			}
		}
	}
	else
	{
		CString	csValue=pcslValues->GetHead();

		switch(pclData->m_pub_fn_tdeGetDataType())
		{
			case CTL_DATA_TYPE__ENUM:
			{
				*(long *)pvEngineData=atol(M_MAKECHAR(csValue));
			}
			break;

			case CTL_DATA_TYPE__INTEGER:
			{
				long	lValue=atol(M_MAKECHAR(csValue));
				memcpy(pvEngineData,&lValue,((CTL_Editor_IntegerData *)pclData)->m_cDataSize);
			}
			break;

			case CTL_DATA_TYPE__DECIMAL:
			{
				*(MTH_tdxReal *)pvEngineData=(MTH_tdxReal)atof(M_MAKECHAR(csValue));
			}
			break;

			case CTL_DATA_TYPE__BOOLEAN:
			{
				if(csValue==g_c_csTrue)
					*(unsigned char *)pvEngineData=1;
				else
					*(unsigned char *)pvEngineData=0;
			}
			break;

			case CTL_DATA_TYPE__TEXT:
			{
			}
			break;

			case CTL_DATA_TYPE__VECTOR:
			{
				long		lIndex=0;
				CString	csX=fn_csGetNextWord(csValue,lIndex);
				CString	csY=fn_csGetNextWord(csValue,lIndex);
				CString	csZ=fn_csGetNextWord(csValue,lIndex);

				((MTH3D_tdstVector *)pvEngineData)->xX=(MTH_tdxReal)atof(M_MAKECHAR(csX));
				((MTH3D_tdstVector *)pvEngineData)->xY=(MTH_tdxReal)atof(M_MAKECHAR(csY));
				((MTH3D_tdstVector *)pvEngineData)->xZ=(MTH_tdxReal)atof(M_MAKECHAR(csZ));
			}
			break;

//ANNECY Bart#02 24/04/98 {
      case CTL_DATA_TYPE__MASKED:
      {
				unsigned long ulValue=strtoul(M_MAKECHAR(csValue),NULL,10);
        *(unsigned long *)pvEngineData=ulValue;
      }
      break;
//ENDANNECY Bart#02 }

	  // BEGIN ROMTEAM Cristi Petrescu 98-11-
	  // shouldn't we use m_fn_pcslFormatDataValueString ?!!!!
	  // another example of poor design. we cannot use it because cannot compile for the enums...
	  // maybe define a new call back?!
	  // or use the control call back?! - who cares, it's only used here.
	  case CTL_DATA_TYPE__ARRAY:
		{
			CTL_Editor_ArrayData *pclArrayData;
			pclArrayData = (CTL_Editor_ArrayData *) pclData;
			CTL_Editor_Control *pclControl;
			pclControl = pclArrayData -> m_pub_fn_pclGetParentControl ();
			tdstArray		*pstArray;
			pstArray = (tdstArray *) pclArrayData -> m_pub_fn_pvGetMotorData ();
			// BEGIN ROMTEAM Cristi Petrescu 99-01- debug
			long			lNbElt, lOldNbElt;
			// BEGIN ROMTEAM Cristi Petrescu 98-12-
			lNbElt=M_ARRAY_SIZE(pstArray);
			if (lNbElt == 0)
				break;
			lOldNbElt = pcslValues -> GetCount ();
			// for safety
			if (lOldNbElt == 0)
				pcslValues -> AddTail ("0 0 0");
			while (lNbElt < lOldNbElt)
			{
				pcslValues -> RemoveTail ();
				lOldNbElt --;
			}
			while (lNbElt > lOldNbElt)
			{
				pcslValues -> AddTail (pcslValues -> GetTail ());
				lOldNbElt ++;
			}
			// END ROMTEAM Cristi Petrescu 99-01- debug
			//lNbElt = pcslValues -> GetCount ();
			//M_ARRAY_SIZE (pstArray) = lNbElt;
			// END ROMTEAM Cristi Petrescu 98-12-
			tdstGetSetParam	stGetSetParam;

			switch (pclControl -> m_pub_fn_tdeGetDataType ())
			{
			case CTL_DATA_TYPE__ARRAY_ENUM:
				{
					ASSERT((M_ARRAY_TYPE(pstArray)==eDsgVarType_Perso) ||
								 (M_ARRAY_TYPE(pstArray)==eDsgVarType_WayPoint) ||
								 (M_ARRAY_TYPE(pstArray)==eDsgVarType_Text));

					POSITION	pos=pcslValues->GetHeadPosition();
					long			lIndex=0;
					while(pos!=NULL && lIndex<lNbElt)
					{
						csValue=pcslValues->GetNext(pos);
						if(M_ARRAY_TYPE(pstArray)==eDsgVarType_Perso)
							M_GetSetParam_lValue(&stGetSetParam) = atol(M_MAKECHAR(csValue));
						else
						if(M_ARRAY_TYPE(pstArray)==eDsgVarType_WayPoint)
							M_GetSetParam_WayPointValue(&stGetSetParam) = (struct WP_tdstWayPoint_ *)atol(M_MAKECHAR(csValue));
						else
						if(M_ARRAY_TYPE(pstArray)==eDsgVarType_Text)
							M_GetSetParam_hText(&stGetSetParam) = (FON_tdxHandleOfText) atol(M_MAKECHAR(csValue));

						fn_ucSetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);

						lIndex++;
					}
				}
				break;

			case CTL_DATA_TYPE__ARRAY_VECTOR:
				{
					ASSERT(M_ARRAY_TYPE(pstArray)==eDsgVarType_Vector);

					POSITION	pos=pcslValues->GetHeadPosition();
					long			lIndex=0;
					while(pos!=NULL && lIndex<lNbElt)
					{
						csValue=pcslValues->GetNext(pos);
						long		lTmpIndex=0;
						CString	csX=fn_csGetNextWord(csValue,lTmpIndex);
						CString	csY=fn_csGetNextWord(csValue,lTmpIndex);
						CString	csZ=fn_csGetNextWord(csValue,lTmpIndex);

						MTH3D_tdstVector	*pstVector=&(M_GetSetParam_stVertexValue(&stGetSetParam));
						MTH3D_M_xGetXofVector(pstVector)=(MTH_tdxReal)atof(M_MAKECHAR(csX));
						MTH3D_M_xGetYofVector(pstVector)=(MTH_tdxReal)atof(M_MAKECHAR(csY));
						MTH3D_M_xGetZofVector(pstVector)=(MTH_tdxReal)atof(M_MAKECHAR(csZ));

						fn_ucSetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);

						lIndex++;
					}
				}
				break;

			case CTL_DATA_TYPE__ARRAY_DECIMAL:
				{
					ASSERT(M_ARRAY_TYPE(pstArray)==eDsgVarType_Float);

					POSITION	pos=pcslValues->GetHeadPosition();
					long			lIndex=0;
					while(pos!=NULL && lIndex<lNbElt)
					{
						csValue=pcslValues->GetNext(pos);
						M_GetSetParam_xValue(&stGetSetParam)=(MTH_tdxReal)atof(M_MAKECHAR(csValue));
						M_GetSetParam_Type(&stGetSetParam) = E_vt_Float;

						fn_ucSetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);

						lIndex++;
					}
				}
				break;
			case CTL_DATA_TYPE__ARRAY_INTEGER:
				{
					ASSERT(M_ARRAY_TYPE(pstArray)==eDsgVarType_Integer);

					POSITION	pos=pcslValues->GetHeadPosition();
					long			lIndex=0;
					while(pos!=NULL && lIndex<lNbElt)
					{
						csValue=pcslValues->GetNext(pos);
						M_GetSetParam_lValue(&stGetSetParam)=atol(M_MAKECHAR(csValue));

						fn_ucSetDsgVarValue(M_ARRAY_ELEMENT(pstArray,lIndex),0,M_ARRAY_TYPE(pstArray),&stGetSetParam);

						lIndex++;
					}
				}

				break;

			default:
				{
					AfxMessageBox("Pb with SetValueInDsgVar - array");
				}
			}
		}
		break;
		// END ROMTEAM Cristi Petrescu 98-11-

			default:
			{
				AfxMessageBox("Pb with SetValueInDsgVar");
			}
		}
	}

	pclData->m_fn_vGetMotorData();
}


/****************************************************************************/
void fn_vUpdateWatchData (CTL_Editor_Data *pclData,enum CTL_eUpdateReason,long l)
{
	if (fn_bIsInWatch(pclData))
	{
		WAW_fn_vRefreshWatchWindow();
/*		WAW_Data *pclWatchData=fn_pclGetWatchData(pclData);

		CString	csValue=fn_csGetValue(pclWatchData);
		WAW_fn_bUpdateData(pclWatchData,csValue);
*/	}
}

#endif //D_ED_IR_ACTIVE
