00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00068 #ifndef _FORMATIONS_
00069 #define _FORMATIONS_
00070
00071 #include "SoccerTypes.h"
00072
00073
00074
00075
00076
00094 class PlayerTypeInfo
00095 {
00096 PlayerT playerType;
00097 double dAttrX;
00098 double dAttrY;
00099 double dMinX;
00100 double dMaxX;
00101 bool bBehindBall;
00103 public:
00104 PlayerTypeInfo( );
00105 PlayerTypeInfo( PlayerT, double, double, double, double, bool );
00106
00107
00108 bool setValues( PlayerT, double, double, double, double, bool );
00109 void show ( ostream &os = cout );
00110
00111
00112 bool setPlayerType ( PlayerT type );
00113 PlayerT getPlayerType ( ) const;
00114 bool setAttrX ( double attrX );
00115 double getAttrX ( ) const;
00116 bool setAttrY ( double attrY );
00117 double getAttrY ( ) const;
00118 bool setMinX ( double minX );
00119 double getMinX ( ) const;
00120 bool setMaxX ( double maxX );
00121 double getMaxX ( ) const;
00122 bool setBehindBall ( bool b );
00123 bool getBehindBall ( ) const;
00124
00125 };
00126
00127
00128
00129
00130
00131
00138 class FormationTypeInfo
00139 {
00140 FormationT formationType;
00141 VecPosition posHome[ MAX_TEAMMATES ];
00142 PlayerT playerType[ MAX_TEAMMATES ];
00143 PlayerTypeInfo playerTypeInfo[ MAX_PLAYER_TYPES ];
00145 public:
00146 FormationTypeInfo( );
00147 void show( ostream &os = cout );
00148
00149
00150 bool setFormationType ( FormationT type );
00151 FormationT getFormationType ( ) const;
00152 bool setPosHome ( VecPosition pos, int atIndex);
00153 bool setXPosHome ( double x, int atIndex);
00154 bool setYPosHome ( double y, int atIndex);
00155 VecPosition getPosHome ( int atIndex ) const;
00156 bool setPlayerType ( PlayerT type, int atIndex);
00157 PlayerT getPlayerType ( int atIndex ) const;
00158 bool setPlayerTypeInfo ( PlayerTypeInfo info, int atIndex);
00159 PlayerTypeInfo* getPlayerTypeInfo ( int atIndex );
00160 PlayerTypeInfo* getPlayerTypeInfoOfPlayer( int iPlayerInFormation );
00161 };
00162
00163
00164
00165
00166
00173 class Formations
00174 {
00175 FormationTypeInfo formations[ MAX_FORMATION_TYPES ];
00176 FormationT curFormation;
00177 int iPlayerInFormation;
00178 public:
00179 Formations( const char *strFile = NULL, FormationT ft=FT_ILLEGAL, int iNr=1);
00180 void show ( ostream &os = cout );
00181
00182
00183 VecPosition getStrategicPosition( int iPlayer,
00184 VecPosition posBall,
00185 double dMaxXInPlayMode,
00186 bool bInBallPossession = false,
00187 double dMaxYPercentage = 0.75,
00188 FormationT ft = FT_ILLEGAL );
00189
00190
00191 bool readFormations ( const char *strFile );
00192
00193
00194 bool setFormation ( FormationT formation );
00195 FormationT getFormation ( ) const;
00196 bool setPlayerInFormation( int number );
00197 int getPlayerInFormation( ObjectT obj = OBJECT_ILLEGAL ) const;
00198 PlayerT getPlayerType ( ObjectT obj,
00199 FormationT ft = FT_ILLEGAL ) const;
00200 PlayerT getPlayerType ( int iIndex = -1,
00201 FormationT ft = FT_ILLEGAL ) const;
00202 };
00203
00204 #endif