Field< T > Class Template Reference
[Rules]

Game playing ground.Parameter T: Player type (CPlayer or SPlayer). More...

#include <Field.hh>

List of all members.

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]

Detailed Description

template<typename T>
class Field< T >

Game playing ground.

Parameter T: Player type (CPlayer or SPlayer).


Member Function Documentation

template<typename T >
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.

Parameters:
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().

template<typename T >
int Field< T >::getFoulModifier ( const Coordinates coord_attacker,
const Coordinates coord_target 
) const [inline]

Get the modifier provided by assistance during a foul.

Parameters:
coord_attacker Coordinates in field of the player attacking.
coord_target Coordinates in field of the defender.
Returns:
Modifier for armour roll.

References Field< T >::getNbAssister(), and Field< T >::getPlayer().

template<typename T >
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.

Parameters:
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().

template<typename T >
int Field< T >::getNbBlockDices ( const Coordinates coord_attacker,
const Coordinates coord_target 
) const [inline]

Get the number of dices to throw during a block.

Parameters:
coord_attacker Coordinates in field of the player attacking.
coord_target Coordinates in field of the defender.
Returns:
A positive number is returned if his team attacking choose the result, else it is a negative one the absolute value determine the number of dice to roll

References Field< T >::getNbAssister(), and Field< T >::getPlayer().

Referenced by Api::blockDicesNumber().

template<typename T >
int Field< T >::getNbPlayersInEndZone ( int  team_id  )  const [inline]

Get the number of team players in the end zone.

Note:
This is a subroutine of isPlacementValid().

References Coordinates::col, COLS, Field< T >::getPlayer(), Coordinates::row, and ROWS.

Referenced by Field< T >::isPlacementValid().

template<typename T >
int Field< T >::getNbPlayersInLeftWideZone ( int  team_id  )  const [inline]

Get the number of team players in the left wide zone.

Note:
This is a subroutine of isPlacementValid().

References Coordinates::col, Field< T >::getPlayer(), Coordinates::row, ROWS, and SIDE.

Referenced by Field< T >::isPlacementValid().

template<typename T >
int Field< T >::getNbPlayersInMiddle ( int  team_id  )  const [inline]

Get the number of team players in the middle of the field.

Note:
This is a subroutine of isPlacementValid().

References Coordinates::col, COLS, Field< T >::getPlayer(), Coordinates::row, ROWS, and SIDE.

Referenced by Field< T >::isPlacementValid().

template<typename T >
int Field< T >::getNbPlayersInOppositeHalf ( int  team_id  )  const [inline]

Get the number of team players in the opposite half of the field.

Note:
This is a subroutine of isPlacementValid().

References Coordinates::col, COLS, Field< T >::getPlayer(), Coordinates::row, and ROWS.

Referenced by Field< T >::isPlacementValid().

template<typename T >
int Field< T >::getNbPlayersInRightWideZone ( int  team_id  )  const [inline]

Get the number of team players in the right wide zone.

Note:
This is a subroutine of isPlacementValid().

References Coordinates::col, COLS, Field< T >::getPlayer(), Coordinates::row, ROWS, and SIDE.

Referenced by Field< T >::isPlacementValid().

template<typename T >
int Field< T >::getNbPlayersOnLineOfScrimmage ( int  team_id  )  const [inline]

Get the number of team players on the line of scrimmage.

Note:
This is a subroutine of isPlacementValid().

References Coordinates::col, COLS, Field< T >::getPlayer(), Coordinates::row, ROWS, and SIDE.

Referenced by Field< T >::isPlacementValid().

template<typename T >
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.

Parameters:
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().

template<typename T >
int Field< T >::getTackleZonesMalus ( int  team_id,
const Coordinates coord 
) const [inline]

Get the tackle zones malus for a dodge roll.

Parameters:
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().

template<typename T >
bool Field< T >::intoField ( const Coordinates coord  )  const [inline]
template<typename T>
void Field< T >::setPlayer ( const Coordinates coord,
T *  p 
) [inline]

Place a player on the field.

Note:
Don't forget to manually set NULL its previous coordinates.

References Coordinates::col, COLS, and Coordinates::row.

Referenced by SPlayer::setCoordinates(), CPlayer::setCoordinates(), and SPlayer::setStatus().


The documentation for this class was generated from the following files:
Generated on Mon Apr 5 21:17:34 2010 for Stechec/TBT by  doxygen 1.6.3