/*
 =======================================================================================
  Name        :IniData.h
 
  Author      :Vincent lhullier             Date :21/07/97
 
  Description :function for initial value (saving, loading, ... ) Header file
 =======================================================================================
  Modification -> Author :                  Date :
  Description :
 =======================================================================================
 */

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#ifndef __INIDATA_H__
#define __INIDATA_H__
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include <afxdisp.h>
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
typedef struct tdstProject_ tdstProject;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

/*
 =======================================================================================
	Constants
 =======================================================================================
 */
/*
 * Ini file
 */
#define C_szIniFile "ChkData.ini"

/*
 =======================================================================================
	Structures
 =======================================================================================
 */

typedef struct tdstAvailablePaths_
{
	char szGraphicsBanks	[ MAX_PATH ];		// ("GameData\World\Graphics\Objects\Banks")
	char szLevels			[ MAX_PATH ];		// ("GameData\World\Levels")
	char szFamilies			[ MAX_PATH ];		// ("GameData\World\Levels\_Common\Families")
	char szTexture			[ MAX_PATH ];		// ("GameData\World\Graphics\Textures")
	char szGameData			[ MAX_PATH ];		// ("GameData")
	char szWorld			[ MAX_PATH ];		// ("GameData\World")
	char szAnimations		[ MAX_PATH ];		// ("GameData\World\Graphics\Anims")
	char szGraphicsClasses	[ MAX_PATH ];		// ("GameData\World\Graphics\Objects\Classes")
	char szMechanics		[ MAX_PATH ];		// ("GameData\World\Libraries\Mechanics")
	char szSound			[ MAX_PATH ];		// ("GameData\World\Sound")
	char szVisuals			[ MAX_PATH ];		// ("GameData\World\Graphics\Visuals")
	char szMaterials		[ MAX_PATH ];		// ("GameData\World\Libraries\Materials")
	char szEnvironment		[ MAX_PATH ];		// ("GameData\World\Libraries\Environment")
	char szSaveGame			[ MAX_PATH ];		// ("GameData\SaveGame")
	char szVignettes		[ MAX_PATH ];		// ("GameData\Vignette")
	char szOptions			[ MAX_PATH ];		// ("GameData\Options")
	char szZdx				[ MAX_PATH ];		// ("GameData\World\Levels")
	char szCharacters		[ MAX_PATH ];		// ("GameData\World\Levels")
} tdstAvailablePaths;

typedef struct tdstDirectoryType_
{
	char *szPath;
	char szName[ 16 ];
}tdstDirectoryType;

/*
 * structure to store config of file list information
 */
typedef struct tdstFileListConfig_
{
	char			szKey[20];					// congfing entry in vss entry
	char			cIndex;						// current config index
	char			szId[20];					// current config id
	char			szName[40];					// current config name
	long			lNumberOfFiles;				// number of file in current config
	char			**d_szFile;					// list of file name in current config
} tdstFileListConfig;

/*
 * structure to store program information
 */
typedef struct tdstIniData_
{
	char				szLocalPath[MAX_PATH];		// name of local data path
	char				szRootForSection[ MAX_PATH ];
	long				lRootForSectionLength;
	char				szResultFile[MAX_PATH];		// name of file that contains result
	char				szSectionFile[MAX_PATH];

	char				cNumberOfConfigs;			// number of config found in ini file
	tdstFileListConfig	stCheckConfig;

	tdstAvailablePaths	stAvailablePaths;		
	char				cNumberOfDataPaths;
	tdstDirectoryType	a_stDataPath[18];
} tdstIniData;

/*
 * structure to store Window preference and options
 */
typedef struct tdstWindowsPref_
{
	RECT stMainPos;								// main window position and size
}tdstWindowsPref;
 
/*
 =======================================================================================
	GLOBALS 
 =======================================================================================
 */
extern tdstIniData		g_stIniData;			// initial data
extern tdstWindowsPref	g_stWinPref;			// program options

/*
 =======================================================================================
	FUNCTIONS 
 =======================================================================================
 */

/*
 * specific function for file list configuration
 */
void fn_IniD_vFreeFileList( tdstFileListConfig *_p_stFileList );
void fn_IniD_vWriteFileList( tdstFileListConfig *_p_stFileList );
BOOL fn_IniD_bGetFileList( tdstFileListConfig *_p_stFileList, char _cConfig );
void fn_IniD_vSetSingleFileList( tdstFileListConfig *_p_stFileList, char *_szFileName );

char fn_IniD_cGetIndexFromId( char *_szId );
char fn_IniD_cGetNumberOfConfig( void );
void fn_IniD_vGetConfigName( char _cConfig, char *_szName );

/*
 * function to get/set single initial data
 */
BOOL fn_IniD_bGetFileTypeConsiderStatus( char *_szExt );
void fn_IniD_vSetFileTypeConsiderStatus( char *_szExt, BOOL _bConsider );

void fn_IniD_vSetLocalPath( char *_szPath );
void fn_IniD_vSetResultFile( char *_szFileName );

/*
 * function for windows preference data
 */
void fn_IniD_vGetWindowPreference( void );
void fn_IniD_vWriteWindowPreference( void );

/*
 * function for all ini data
 */
void fn_IniD_vGetAllFromIniFile( BOOL _bFirst );

#endif //__INIDATA_H__