CBG  0.1
Compendium of board games
Player Class Reference

#include <Player.h>

Inheritance diagram for Player:
SnakesAndLaddersPlayer

Public Member Functions

 Player ()
 Public constructors. More...
 
 Player (int amountOfTypes, vector< string > types, int maxPieces)
 
virtual ~Player ()
 
int getAmountOfPieces () const
 Public functions. More...
 
bool removePiece (Piece *toBeRemoved)
 
bool hasType (int type) const
 Check if pieces vector at index type is empty. More...
 
bool hasRoomForPiece () const
 
string getCharacter (int type) const
 Returns a string from pieces vector at index type. More...
 
PieceaddPiece ()
 Add pieces to the pieces vector. More...
 
PieceaddPiece (Piece *insert)
 
PiecegetPiece (int index) const
 Returns a reference to the piece in the pieces vector at index. More...
 

Public Attributes

bool suspended
 Return weather this player can move or not. More...
 

Protected Attributes

int amountOfPieces
 
int maxPieces
 Int variable to store the max amount of pieces a player could own. More...
 
int amountOfTypes
 Variable used to store the amount of types of pieces the player has. More...
 
vector< string > types
 Vector to store the different types of pieces the player could own. More...
 
vector< Piece * > pieces
 Vector of type Piece pointer to store all the pieces the player owns. More...
 

Constructor & Destructor Documentation

Player::Player ( )

Public constructors.

Player

Author
Ian Duffy
Darren Brogan
Player::Player ( int  amountOfTypes,
vector< string >  types,
int  maxPieces 
)
Player::~Player ( )
virtual

Member Function Documentation

Piece & Player::addPiece ( )

Add pieces to the pieces vector.

Piece & Player::addPiece ( Piece insert)

Add pieces to the pieces vector at index. Only used by snakes and ladders.

int Player::getAmountOfPieces ( ) const

Public functions.

Returns the amount of pieces.

std::string Player::getCharacter ( int  type) const

Returns a string from pieces vector at index type.

Piece & Player::getPiece ( int  index) const

Returns a reference to the piece in the pieces vector at index.

bool Player::hasRoomForPiece ( ) const

Function to check does the player have room for another piece Necessary to check before adding piece to ensure references never reference a non existant piece.

bool Player::hasType ( int  type) const

Check if pieces vector at index type is empty.

bool Player::removePiece ( Piece toBeRemoved)

Remove Piece from the player and return a bollean to identify if it succeded or failed.

Remove Piece from the player and return a boolean to identify if it succeded or failed.

Member Data Documentation

int Player::amountOfPieces
protected

Protected Data. Int to store the amount of pieces the player currently owns.

int Player::amountOfTypes
protected

Variable used to store the amount of types of pieces the player has.

int Player::maxPieces
protected

Int variable to store the max amount of pieces a player could own.

vector<Piece*> Player::pieces
protected

Vector of type Piece pointer to store all the pieces the player owns.

bool Player::suspended

Return weather this player can move or not.

vector<string> Player::types
protected

Vector to store the different types of pieces the player could own.


The documentation for this class was generated from the following files: