Game playing ground.Parameter T: Player type (CPlayer or SPlayer). More...
#include <Field.hh>
Public Member Functions | |
| bool | intoField (const Coordinates &coord) const |
| Check if the specified coordinates are in the field zone (ie: not outside the border). | |
| Coordinates | dirToCoord (enum eDirection dir) const |
| Convert a cardinal point direction to a Coordinates. | |
| void | setPlayer (const Coordinates &coord, T *p) |
| Place a player on the field. | |
| T * | getPlayer (const Coordinates &coord) const |
| Get the player at the specified coordinates, or NULL. | |
| int | getNbPlayersInOppositeHalf (int team_id) const |
| Get the number of team players in the opposite half of the field. | |
| int | getNbPlayersInLeftWideZone (int team_id) const |
| Get the number of team players in the left wide zone. | |
| int | getNbPlayersInRightWideZone (int team_id) const |
| Get the number of team players in the right wide zone. | |
| int | getNbPlayersOnLineOfScrimmage (int team_id) const |
| Get the number of team players on the line of scrimmage. | |
| int | getNbPlayersInEndZone (int team_id) const |
| Get the number of team players in the end zone. | |
| int | getNbPlayersInMiddle (int team_id) const |
| Get the number of team players in the middle of the field. | |
| int | isPlacementValid (int team_id) const |
| Check if the placement of the team is valid. | |
| bool | hasAdjacentEmptySquare (const Coordinates &coord) const |
| Check if there is an empty square near the given coordinates. | |
| CoordList | getAdjacentEmptySquares (const Coordinates &coord) const |
| Get the players surrounding the given coordinates. | |
| bool | hasAdjacentPlayer (const Coordinates &coord) const |
| Check if there is a player near the given coordinates. | |
| bool | hasAdjacentPlayer (const Coordinates &coord, enum eStatus s, int team_id) const |
| Check if there is a player of the specified team near the given coordinates. | |
| std::vector< T * > | getAdjacentPlayers (const Coordinates &coord) const |
| Get the players surrounding the given coordinates. | |
| std::vector< T * > | getAdjacentPlayers (const Coordinates &coord, enum eStatus s, int team_id) const |
| Get the players of the specified team surrounding the given coordinates. | |
| int | getNbTackleZones (int team_id, const Coordinates &coord) const |
| Get the number of tackle zones for the square made by a team. | |
| int | getTackleZonesMalus (int team_id, const Coordinates &coord) const |
| Get the tackle zones malus for a dodge roll. | |
| bool | canAssist (const Coordinates &coord_assister, int team_id, enum eEffort effort, const Coordinates &coord_target) const |
| Check if the player can assist a block against another player. | |
| int | getNbAssister (const Coordinates &coord_assisted, int team_id, enum eEffort effort, const Coordinates &coord_target) const |
| Get the number of supporter avaible for a block. | |
| int | getNbBlockDices (const Coordinates &coord_attacker, const Coordinates &coord_target) const |
| Get the number of dices to throw during a block. | |
| int | getFoulModifier (const Coordinates &coord_attacker, const Coordinates &coord_target) const |
| Get the modifier provided by assistance during a foul. | |
Protected Attributes | |
| T * | tab_ [COLS *ROWS] |
Game playing ground.
Parameter T: Player type (CPlayer or SPlayer).
| bool Field< T >::canAssist | ( | const Coordinates & | coord_assister, | |
| int | team_id, | |||
| enum eEffort | effort, | |||
| const Coordinates & | coord_target | |||
| ) | const [inline] |
Check if the player can assist a block against another player.
| coord_assister | The coordinates of the player assisting. | |
| team_id | The team id of the team that tackles. (ie: The team of the target). | |
| effort | The type of effort to assist with or against. | |
| coord_target | The coordinates in field of the target (attacker or defender). |
References Field< T >::getNbTackleZones(), Field< T >::getPlayer(), and Coordinates::isNear().
Referenced by Field< T >::getNbAssister().
| int Field< T >::getFoulModifier | ( | const Coordinates & | coord_attacker, | |
| const Coordinates & | coord_target | |||
| ) | const [inline] |
Get the modifier provided by assistance during a foul.
| coord_attacker | Coordinates in field of the player attacking. | |
| coord_target | Coordinates in field of the defender. |
References Field< T >::getNbAssister(), and Field< T >::getPlayer().
| int Field< T >::getNbAssister | ( | const Coordinates & | coord_assisted, | |
| int | team_id, | |||
| enum eEffort | effort, | |||
| const Coordinates & | coord_target | |||
| ) | const [inline] |
Get the number of supporter avaible for a block.
| coord_assisted | Coordinates in field of the player being assisted. | |
| team_id | The team id of the team assister. | |
| effort | The type of effort to assist with or against. | |
| coord_target | Coordinates in field of the target (attacker or defender). |
References Field< T >::canAssist(), Coordinates::col, Field< T >::getPlayer(), Field< T >::intoField(), and Coordinates::row.
Referenced by Field< T >::getFoulModifier(), and Field< T >::getNbBlockDices().
| int Field< T >::getNbBlockDices | ( | const Coordinates & | coord_attacker, | |
| const Coordinates & | coord_target | |||
| ) | const [inline] |
Get the number of dices to throw during a block.
| coord_attacker | Coordinates in field of the player attacking. | |
| coord_target | Coordinates in field of the defender. |
References Field< T >::getNbAssister(), and Field< T >::getPlayer().
Referenced by Api::blockDicesNumber().
| int Field< T >::getNbPlayersInEndZone | ( | int | team_id | ) | const [inline] |
Get the number of team players in the end zone.
References Coordinates::col, COLS, Field< T >::getPlayer(), Coordinates::row, and ROWS.
Referenced by Field< T >::isPlacementValid().
| int Field< T >::getNbPlayersInLeftWideZone | ( | int | team_id | ) | const [inline] |
Get the number of team players in the left wide zone.
References Coordinates::col, Field< T >::getPlayer(), Coordinates::row, ROWS, and SIDE.
Referenced by Field< T >::isPlacementValid().
| int Field< T >::getNbPlayersInMiddle | ( | int | team_id | ) | const [inline] |
Get the number of team players in the middle of the field.
References Coordinates::col, COLS, Field< T >::getPlayer(), Coordinates::row, ROWS, and SIDE.
Referenced by Field< T >::isPlacementValid().
| int Field< T >::getNbPlayersInOppositeHalf | ( | int | team_id | ) | const [inline] |
Get the number of team players in the opposite half of the field.
References Coordinates::col, COLS, Field< T >::getPlayer(), Coordinates::row, and ROWS.
Referenced by Field< T >::isPlacementValid().
| int Field< T >::getNbPlayersInRightWideZone | ( | int | team_id | ) | const [inline] |
Get the number of team players in the right wide zone.
References Coordinates::col, COLS, Field< T >::getPlayer(), Coordinates::row, ROWS, and SIDE.
Referenced by Field< T >::isPlacementValid().
| int Field< T >::getNbPlayersOnLineOfScrimmage | ( | int | team_id | ) | const [inline] |
Get the number of team players on the line of scrimmage.
References Coordinates::col, COLS, Field< T >::getPlayer(), Coordinates::row, ROWS, and SIDE.
Referenced by Field< T >::isPlacementValid().
| int Field< T >::getNbTackleZones | ( | int | team_id, | |
| const Coordinates & | coord | |||
| ) | const [inline] |
Get the number of tackle zones for the square made by a team.
| team_id | The team id of the team that tackles. (ie: The opposing team). | |
| coord | Coordinates in field to look for. |
References Field< T >::getAdjacentPlayers().
Referenced by Field< T >::canAssist(), Api::moveDifficulty(), Api::throwDifficulty(), SPlayer::tryCatchBall(), SPlayer::tryMove(), SPlayer::tryPickUp(), and SPlayer::tryThrow().
| int Field< T >::getTackleZonesMalus | ( | int | team_id, | |
| const Coordinates & | coord | |||
| ) | const [inline] |
Get the tackle zones malus for a dodge roll.
| team_id | The team id of the team that tackles. (ie: The opposing team). | |
| coord | Coordinates in field to look for. |
References Field< T >::getAdjacentPlayers().
Referenced by Api::moveDifficulty(), and SPlayer::tryDodge().
| bool Field< T >::intoField | ( | const Coordinates & | coord | ) | const [inline] |
Check if the specified coordinates are in the field zone (ie: not outside the border).
References Coordinates::col, COLS, Coordinates::row, and ROWS.
Referenced by Api::doPlaceBall(), SPlayer::finishBlockAction(), SPlayer::finishBlockPush(), Field< T >::getAdjacentEmptySquares(), Field< T >::getNbAssister(), Field< T >::getPlayer(), Field< T >::hasAdjacentEmptySquare(), CPlayer::move(), SPlayer::setCoordinates(), CPlayer::setCoordinates(), and SPlayer::tryBlockPush().
| void Field< T >::setPlayer | ( | const Coordinates & | coord, | |
| T * | p | |||
| ) | [inline] |
Place a player on the field.
References Coordinates::col, COLS, and Coordinates::row.
Referenced by SPlayer::setCoordinates(), CPlayer::setCoordinates(), and SPlayer::setStatus().
1.6.3