Data model for a single player of the game, tracking also the number of counters held by this player.
More...
#include <player.hpp>
|
void | initializeWithRole (RoleID role) |
| Assigns a role (black or white) to this player, and initializes the set of pieces corresponding to that role.
|
|
uint8_t | deductCounters (uint8_t counters) |
| Deducts some quantity of counters from this player's bank.
|
|
void | depositCounters (uint8_t counters) |
| Deposits some quantity of counters to this player's bank.
|
|
uint8_t | getNPieces (Piece::State inState) const |
| Returns the number of pieces owned by this player in a particular state.
|
|
uint8_t | getNCounters () const |
| Gets the number of counters currently held by this player.
|
|
RoleID | getRole () const |
| Gets the role (black or white or neither) currently assigned to this player for this game.
|
|
std::weak_ptr< Piece > | getPiece (PieceTypeID pieceType) |
| Gets a reference to the data model of some piece owned by this player.
|
|
const Piece & | cGetPiece (PieceTypeID pieceType) const |
| Gets (a const reference to) a piece owned by this player corresponding to a requested type.
|
|
|
RoleID | mRole { NA } |
| The role (black or white) assigned to this player.
|
|
std::array< std::shared_ptr< Piece >, 5 > | mPieces { nullptr } |
| References to the data models of all the pieces owned by this player.
|
|
uint8_t | mCounters { 25 } |
| The number of counters currently held by this player.
|
|
Data model for a single player of the game, tracking also the number of counters held by this player.
◆ cGetPiece()
Gets (a const reference to) a piece owned by this player corresponding to a requested type.
- Parameters
-
pieceType | The type of this player's piece we want the data model of. |
- Returns
- const Piece& A const reference to the requested piece.
◆ deductCounters()
uint8_t Player::deductCounters |
( |
uint8_t | counters | ) |
|
Deducts some quantity of counters from this player's bank.
- Parameters
-
counters | The number of counters to be deducted per request. |
- Returns
- uint8_t The number of counters actually deducted.
◆ depositCounters()
void Player::depositCounters |
( |
uint8_t | counters | ) |
|
Deposits some quantity of counters to this player's bank.
- Parameters
-
counters | The number of counters to be added to this player's bank. |
◆ getNCounters()
uint8_t Player::getNCounters |
( |
| ) |
const |
|
inline |
Gets the number of counters currently held by this player.
- Returns
- uint8_t The number of counters held by this player.
◆ getNPieces()
Returns the number of pieces owned by this player in a particular state.
- Parameters
-
inState | The state whose game piece count we want. |
- Returns
- uint8_t The number of this player's pieces matching the state.
◆ getPiece()
Gets a reference to the data model of some piece owned by this player.
- Parameters
-
pieceType | The type of piece whose reference we want. |
- Returns
- std::weak_ptr<Piece> The reference to the requested piece.
- Todo
- Why did I make this a pointer in the first place? I forget.
◆ getRole()
RoleID Player::getRole |
( |
| ) |
const |
|
inline |
Gets the role (black or white or neither) currently assigned to this player for this game.
- Returns
- RoleID The role assigned to this player.
◆ initializeWithRole()
void Player::initializeWithRole |
( |
RoleID | role | ) |
|
Assigns a role (black or white) to this player, and initializes the set of pieces corresponding to that role.
- Parameters
-
role | The role (black or white) being assigned to this player. |
◆ mPieces
std::array<std::shared_ptr<Piece>, 5> Player::mPieces { nullptr } |
|
private |
References to the data models of all the pieces owned by this player.
- Todo
- Once again, why did these need to be pointers?
The documentation for this class was generated from the following files:
- src/app/game_of_ur_data/player.hpp
- src/app/game_of_ur_data/player.cpp