The state of a single piece of the game.
More...
#include <piece.hpp>
|
enum class | State : uint8_t { UNLAUNCHED
, ON_BOARD
, FINISHED
} |
| A value representing the (high level) state of this piece.
|
|
|
| Piece (PieceTypeID type, RoleID owner) |
| Constructs a new Piece.
|
|
RoleID | getOwner () const |
| Gets the owner of this piece, the set to which this piece belongs.
|
|
PieceTypeID | getType () const |
| Gets the type of piece this piece is.
|
|
PieceIdentity | getIdentity () const |
| Gets the identity of this piece, both its type and owner.
|
|
State | getState () const |
| Gets the (high level) state of this piece.
|
|
glm::u8vec2 | getLocation () const |
| Gets the current location of this piece on the board.
|
|
void | setState (State state) |
| Sets the (high level) state of this piece.
|
|
void | setLocation (glm::u8vec2 location) |
| Sets the location of this piece on the board.
|
|
bool | canMove (uint8_t roll, RoleID player) const |
| Tests whether this piece can be moved at all.
|
|
|
State | mState { State::UNLAUNCHED } |
| The current (high level) state of this piece.
|
|
PieceIdentity | mIdentity |
| The unique identity of this piece.
|
|
glm::u8vec2 | mLocation {0, 0} |
| This piece's current location with respect to the game board.
|
|
The state of a single piece of the game.
◆ Piece()
Constructs a new Piece.
- Parameters
-
type | The type of piece represented by this object. |
owner | The set to which this piece belongs (black or white). |
◆ canMove()
bool Piece::canMove |
( |
uint8_t | roll, |
|
|
RoleID | player ) const |
Tests whether this piece can be moved at all.
For this piece to report that it can move, it should either be on the board or unlaunched, and if unlaunched the roll must correspond to this piece type's launch roll.
- Parameters
-
roll | The roll with which we'd like to move this piece. |
player | The player requesting the move. |
- Return values
-
true | This piece may move. |
false | This piece can't move. |
◆ getIdentity()
Gets the identity of this piece, both its type and owner.
- Returns
- PieceIdentity The identity of this piece.
◆ getLocation()
glm::u8vec2 Piece::getLocation |
( |
| ) |
const |
|
inline |
Gets the current location of this piece on the board.
- Returns
- glm::u8vec2 The location of this piece on the board.
◆ getOwner()
RoleID Piece::getOwner |
( |
| ) |
const |
|
inline |
Gets the owner of this piece, the set to which this piece belongs.
- Returns
- RoleID The owner of this piece or the set to which it belongs.
◆ getState()
State Piece::getState |
( |
| ) |
const |
|
inline |
Gets the (high level) state of this piece.
- Returns
- State This piece's state.
◆ getType()
Gets the type of piece this piece is.
- Returns
- PieceTypeID This piece's type.
◆ setLocation()
void Piece::setLocation |
( |
glm::u8vec2 | location | ) |
|
|
inline |
Sets the location of this piece on the board.
- Parameters
-
location | This piece's new location. |
◆ setState()
void Piece::setState |
( |
State | state | ) |
|
|
inline |
Sets the (high level) state of this piece.
- Parameters
-
state | This piece's new state. |
The documentation for this class was generated from the following files:
- src/app/game_of_ur_data/piece.hpp
- src/app/game_of_ur_data/piece.cpp