#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 | readFormations (const char *strFile) |
bool | setFormation (FormationT formation) |
FormationT | getFormation () const |
bool | setPlayerInFormation (int number) |
int | getPlayerInFormation () const |
PlayerT | getPlayerType (int iIndex=-1) const |
Private Attributes | |
FormationTypeInfo | formations [MAX_FORMATION_TYPES] |
FormationT | curFormation |
int | iPlayerInFormation |
Definition at line 168 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 447 of file Formations.C. References curFormation, FormationT, readFormations(), and setPlayerInFormation(). |
|
This method returns the current formation.
Definition at line 647 of file Formations.C. 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 664 of file Formations.C. References iPlayerInFormation. Referenced by WorldModel::getStrategicPosition(), and Player::Player(). |
|
This method returns the player type for the agent in the current formation
Definition at line 671 of file Formations.C. References curFormation, formations, iPlayerInFormation, and PlayerT. Referenced by Player::mainLoop(), 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 492 of file Formations.C. References curFormation, formations, PlayerTypeInfo::getAttrX(), PlayerTypeInfo::getAttrY(), PlayerTypeInfo::getBehindBall(), PlayerTypeInfo::getMaxX(), PlayerTypeInfo::getMinX(), VecPosition::getX(), VecPosition::getY(), and PITCH_WIDTH. Referenced by WorldModel::getStrategicPosition(). |
|
This method reads the formations from the file 'strFile' and has the following format:
Definition at line 538 of file Formations.C. 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 639 of file Formations.C. 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 656 of file Formations.C. 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 465 of file Formations.C. References curFormation, formations, iPlayerInFormation, MAX_FORMATION_TYPES, and FormationTypeInfo::show(). |
|
type of the current formation Definition at line 171 of file Formations.h. Referenced by Formations(), getFormation(), getPlayerType(), getStrategicPosition(), setFormation(), and show(). |
|
stored formations Definition at line 170 of file Formations.h. Referenced by getPlayerType(), getStrategicPosition(), readFormations(), and show(). |
|
role agent in current formation Definition at line 172 of file Formations.h. Referenced by getPlayerInFormation(), getPlayerType(), setPlayerInFormation(), and show(). |