#ifndef SFEFORMATION_H
#define SFEFORMATION_H

#include <iostream>
#include "Common/World/Point.h"


//#pragma warning(disable:4786)



const int FORMATION_NONE = -1;
const int FORMATION_622 = 0;
const int FORMATION_532 = 1;
const int FORMATION_523 = 2;
const int FORMATION_433 = 3;
const int FORMATION_343 = 4;
const int FORMATION_334 = 5;
const int FORMATION_226 = 6;
const int FORMATION_451 = 7;
const int FORMATION_442 = 8;
  
const int FORMATION_COUNT = 9;

const float FIELD_LENGTH = 105.0f;
const float HALF_FIELD_LENGTH = FIELD_LENGTH / 2;
const float FIELD_WIDTH = 68.0f;
const float HALF_FIELD_WIDTH = FIELD_WIDTH / 2;

const float DEF_MIN = -45.0f;
const float DEF_MAX = -5.0f;
const float MID_MIN = -30.0f;
const float MID_MAX = 30.0f;
const float FOR_MIN = -10.0f;
const float FOR_MAX = 50.0f;
const float Y_DEF_AREA = 6.0f;
const float DEF_LINE = -30.0f;
const float MID_LINE = 0.0f;
const float FOR_LINE = 30.0f;


enum FormationRole {
	PR_GoalKeeper,
	PR_Defensman,
	PR_Midfielder,
	PR_Forward,
	
	PR_Count
};

struct PLAYER_FORM_INFO
{ Point m_AbsPos;
  FormationRole m_Role;
};



const int PLAYER_COUNT = 11;
const int SIDE_NONE = 0;
const int SIDE_LEFT = 1;
const int SIDE_RIGHT = -1;

const int INITIAL_FORMATION = FORMATION_433;

class Formation {
public:


	PLAYER_FORM_INFO m_Formation[PLAYER_COUNT];
	PLAYER_FORM_INFO m_PreDefFormations[FORMATION_COUNT][PLAYER_COUNT];

	int m_nTeamSide;

	Formation();
	~Formation() {};

	void InitializeFormation (int FormationId);
	FormationRole GetPlayerRole (int nTeamSide, int nPlayerId);
	void SetSide( int side ) { m_nTeamSide = side; }
	Point GetPlayerPosition( int nPlayerId, const Point& cBallPos );
	Point GetPlayerPosition( int nTeamSide, const nPlayerId );
	void SetPlayerPosition( int nTeamSide, const nPlayerId, Point pozicia );
	void SetPlayerRole (int nTeamSide, const nPlayerId, FormationRole role);
	int GetRoleCount(int nTeamSide, FormationRole role);
	int GetFormationId(int def, int mid, int att);
	Point GetPlayerPositionInFormation(int nPlayerId, int FormationId);

	};


#endif			// SFEFORMATION_H
