#include <Formations.h>
Collaboration diagram for Formations:
Public Methods | |
Formations (const char *strFile=NULL, FormationT ft=FT_ILLEGAL, int iNr=1) | |
void | show (ostream &os=cout) |
VecPosition | getStrategicPosition (int iPlayer, VecPosition posBall, double dMaxXInPlayMode, bool bInBallPossession=false, double dMaxYPercentage=0.75, FormationT ft=FT_ILLEGAL) |
bool | readFormations (const char *strFile) |
bool | setFormation (FormationT formation) |
FormationT | getFormation () const |
bool | setPlayerInFormation (int number) |
int | getPlayerInFormation (ObjectT obj=OBJECT_ILLEGAL) const |
PlayerT | getPlayerType (ObjectT obj, FormationT ft=FT_ILLEGAL) const |
PlayerT | getPlayerType (int iIndex=-1, FormationT ft=FT_ILLEGAL) const |
Private Attributes | |
FormationTypeInfo | formations [MAX_FORMATION_TYPES] |
FormationT | curFormation |
int | iPlayerInFormation |
Definition at line 173 of file Formations.h.
|
This is the constructor for the Formations class and needs as arguments a formation configuration file, the current formation and the number of the agent in this formation (normally at start-up this equals the player number).
Definition at line 448 of file Formations.cpp. References curFormation, FormationT, readFormations(), and setPlayerInFormation(). |
|
This method returns the current formation.
Definition at line 652 of file Formations.cpp. References curFormation, and FormationT. Referenced by Player::deMeer5(), and Player::deMeer5_goalie(). |
|
This method returns the role number of the agent in the current formation
Definition at line 669 of file Formations.cpp. References SoccerTypes::getIndex(), iPlayerInFormation, OBJECT_ILLEGAL, and ObjectT. Referenced by WorldModel::getStrategicPosition(), and Player::Player(). |
|
This method returns the player type for the agent in the current formation
Definition at line 692 of file Formations.cpp. References curFormation, formations, FormationT, FT_ILLEGAL, FormationTypeInfo::getPlayerType(), iPlayerInFormation, and PlayerT. |
|
This method returns the player type for the specified object
Definition at line 682 of file Formations.cpp. References curFormation, formations, FormationT, FT_ILLEGAL, SoccerTypes::getIndex(), FormationTypeInfo::getPlayerType(), ObjectT, and PlayerT. Referenced by WorldModel::getClosestPlayerInFormationTo(), WorldModel::getPlayerType(), Player::mainLoop(), Player::performPenalty(), and Player::Player(). |
|
This method returns the strategic position for a player. It calculates this information by taking the home position of the current role in the current formation and combines this with the position of the ball using the attraction values for the current player type. The attraction values defines the percentage of the ball coordinate that is added to the home position of the current player type. So when the x coordindate of the home position is 10.0, x coordinate ball is 20.0 and x attraction is 0.25. The x coordinate of the strategic position will become 10.0 + 0.25*20.0 = 15.0. When this value is smaller than the minimal x coordinate or larger than the maximal x coordinate, the coordinate is changed to this minimal or maximal coordinate respectively. Also when the behind ball value is set, the x coordinate of the strategic position is set to this ball coordinate. Furthermore when the strategic position is in front of the supplied argument dMaxXInPlayMode, the x coordinate is adjusted to this value. During normal play mode the supplied value is often the offside line.
Definition at line 493 of file Formations.cpp. References curFormation, formations, FormationT, FT_ILLEGAL, PlayerTypeInfo::getAttrX(), PlayerTypeInfo::getAttrY(), PlayerTypeInfo::getBehindBall(), PlayerTypeInfo::getMaxX(), PlayerTypeInfo::getMinX(), VecPosition::getX(), VecPosition::getY(), PITCH_WIDTH, and sign(). Referenced by WorldModel::getStrategicPosition(). |
|
This method reads the formations from the file 'strFile' and has the following format:
Definition at line 543 of file Formations.cpp. References formations, FormationTypeInfo::getPlayerTypeInfo(), Parse::gotoFirstNonSpace(), MAX_PLAYER_TYPES, MAX_TEAMMATES, Parse::parseFirstDouble(), Parse::parseFirstInt(), PlayerT, PlayerTypeInfo::setAttrX(), PlayerTypeInfo::setAttrY(), PlayerTypeInfo::setBehindBall(), PlayerTypeInfo::setMaxX(), PlayerTypeInfo::setMinX(), FormationTypeInfo::setPlayerType(), FormationTypeInfo::setXPosHome(), and FormationTypeInfo::setYPosHome(). Referenced by Formations(). |
|
This method sets the current formation.
Definition at line 644 of file Formations.cpp. References curFormation, and FormationT. Referenced by Player::deMeer5(), and Player::deMeer5_goalie(). |
|
This method sets the player number of the agent in the current formation to 'iNumber'.
Definition at line 661 of file Formations.cpp. References iPlayerInFormation. Referenced by Formations(). |
|
This methods prints all the information of the different formation types to the output stream os and furthermore prints the current formation and the role number of the agent in this formation.
Definition at line 466 of file Formations.cpp. References curFormation, formations, iPlayerInFormation, MAX_FORMATION_TYPES, and FormationTypeInfo::show(). |
|
type of the current formation Definition at line 176 of file Formations.h. Referenced by Formations(), getFormation(), getPlayerType(), getStrategicPosition(), setFormation(), and show(). |
|
stored formations Definition at line 175 of file Formations.h. Referenced by getPlayerType(), getStrategicPosition(), readFormations(), and show(). |
|
role agent in current formation Definition at line 177 of file Formations.h. Referenced by getPlayerInFormation(), getPlayerType(), setPlayerInFormation(), and show(). |