/*
*	Project.h
*	----------------------------------------
*	A part of "Intelligent AI"
*	© 1999 SCC Team 064
*	----------------------------------------
*	This file:
*		€ Contains the definitions of the functions used 
*			in this program
*		€ Contains the definitions of the unit types 
*		€ Contains the unit struct which contains the list of 
*			each units attributes
*		€ Contains a struct to keep track of a buildings X and Y 
*			coordinates
*/


/* When the AI calls this function, it sends the attributes of the unit by reference, and this 
* function would modifie them directly since the attributes are sent by reference they would be 
* changed in the actualy place where they are saved, and thus the changes would be global
* however i am not sure this will work, just a preconsieved notion of an idea */

// will be registered every time it is called, therefor they register faster, but may register

/* Each AI should create its own unit array of type uAttributes a the begining of the program 
* this way the player number is irrelevent, or at least not important should the functions be 
* implemented as such. Also, to provide interaction beween the players, when a unit it built, that 
* unit should not only be assed to the players unit array, but also to the other players enemy 
* array - since the actual player is irrelevent when copmparing units in say the range function - 
* where each element is of type unitID that way to allow for the simulation to interact with the 
* players.  And, making the units specific to player will allow for an accurate representation of 
* realality, where iether side realy knows very little about the opponents players, only simply that 
* they are an enemy. This implementation would also take advantage of the benifits behind object 
* oriented programing, utalizing its capabilites to thier fullest, allowing for an easily understood, 
* versitile, advanced level of of programing. */

/* This method allows for true seperation between the client and class implementations, thus providing
* for a program written of an advanced level code - underlieing its importance.  
* This is a more advanced way to code which is probably something that we should take advantage of */


#ifndef 	Project_h
#define 	Project_h

#include <iostream.h>



/* These functions are contained in shell.cp */
/* --------------------------------------------------------------------------- */
void	initialInterface();
void	exitInterface(unsigned long cycleCounter);	


/* These functions are contained in initalize.cp */
/* --------------------------------------------------------------------------- */
void	CreateUnit(int whichType);
void	initStartLocations();
void	initGeneral();
void	initSimState();
//void	interfaceCntrl();
void	init_stdAttributes(int i, int whichType);
int		finalReport(int runTimes);		//variables need to be added to this function


/* Standard Attributes */
/* --------------------------------------------------------------------------- */
//void			storeStdAttributes(int whichType, uAttributes *attributes);
//uAttributes	getStdAttributes(int whichType);


/* Current Number of Players */
/* --------------------------------------------------------------------------- */
void 		storeCurrentNumPlayers(int num);
int 		getCurrentNumPlayers();


/* These functions are contained in store-retrieve.cp */
/* --------------------------------------------------------------------------- */
//FOR MULTIPLE PLAYERS PER TEAM
int		getAIType(int whichPlayer);
void	storeAIType(int whichPlayer, int whichAIType);


/* These functions are contained in simulation.cp */
/* --------------------------------------------------------------------------- */
void 	runSimulation();


/* The AI functions contained in AI.cp */
/* --------------------------------------------------------------------------- */
void	ConstantAI(int i);
void 	EvolvingAI(int i);
void	HumanAI(int i);
void	AutoAttack(int i);


/* Constants */
/* ------------------------------------------------------------------------------------ */
#define	MAX_PLAYERS				2
#define	NUM_UNIT_TYPES			3		//For Different ships, posibly 3
#define	MAX_UNITS				1		//For multiple player teams

#define	SIMFIGHTER				0
#define	SCOUT					1
#define	MINIFIGHTER				2

#define	inactive				3
#define	turning					4
#define	attacking				5

#define	constantAI				6
#define	evolvingAI				7
#define	humanAI					8

#define 	M_PI				3.14159265358979323846
#define	M_PI2					M_PI / 2.

#define	gravity					9.8


/*
*Since these units have thier place in the struct, the functions just manipulate the 
*attributes for the unit reletivly (it doen't matter if a sniper bullet hits an infantry 
*man or a tank, it will still take away the same amount of damage -  however some 
*things might have better protection against say the flameThrower, and thus might be 
*hurt less, whereas in such a case this structure might require some reworking)
*/

/* This struct contains the information about each unit's atributes - 
	thier current status */
struct uAttributes
{
	int	 			lockOn;
	bool			underFire;
	bool			firing;
	bool			flashColor;
	int				hitPoints;
	int				damage;

	float			range;
	bool			canSee[MAX_PLAYERS];

	double			xPos;
	double			yPos;
	double			zPos;

	double			speedX;
	double			speedY;
	double			speedZ;

	long double		turnRate;
	long double		turnRate2;

	double			liftCoef;
	double			dragCoef;
	double			mass;
	double			thrust;
	double			maxThrust;

	long double		pitch;
	long double		yaw;
	long double		roll;
	long double		oldTargetYaw;
	long double		targetYaw;
	long double		targetPitch;
	long double		targetRoll;

	int				uType;
	int				status;
};


/* --------------------------------------------------------------------------- */
/* This creats a class of players:
	€ each player with an array of units (each with attributes defined by the uAttributes struct)
	€ the functions to which the plaeyr has access
	€ the player's AI Type (presetAI, or intelligentAI)
*/
class player_class : public uAttributes
{
	public:
		int 		AIType;
		int			whichPlayer;
		void 		Notify(int event, int player, int data);
		void		Move();
		void 		ContinueMoving();
		void		Attack(player_class &enemy);
		void		UnitRange();
		void 		CollisionDetection(player_class &enemy);
		friend void	PlayerElimination();

					~player_class() {};
};
extern player_class	player[MAX_PLAYERS];

extern bool			Left, Right, Up, Down;


#endif


