#include <history.h>
A History is never void (getSize() can be used as the is the current turn number for the complete game history).
History starts at zero.
The top of the history is an empty Turn until it has been filled and game is up to a new round.
getCurrentRack() can/should be used to store the current played rack. setCurrentRack must be called whenever the current played rack is modified.
History owns the turns that it stores. Do not delete a turn referenced by History
Definition at line 56 of file history.h.
Public Member Functions | |
History () | |
virtual | ~History () |
int | getSize () const |
get the size of the history | |
const PlayedRack & | getCurrentRack () const |
Get the (possibly incomplete) rack. | |
void | setCurrentRack (const PlayedRack &iPld) |
Set the current rack. | |
const Turn & | getPreviousTurn () const |
Get the previous turn. | |
const Turn & | getTurn (unsigned int) const |
Get turn 'n'. | |
void | playRound (int player, int turn, const Round &round) |
Update the "history" with the given round and complete the turn. | |
void | removeLastTurn () |
Remove last turn. | |
string | toString () const |
String handling. |
|
Definition at line 40 of file history.cpp. |
|
Definition at line 48 of file history.cpp. |
|
Get the (possibly incomplete) rack.
Definition at line 67 of file history.cpp. Referenced by Player::getCurrentRack(). |
|
Get the previous turn.
Definition at line 79 of file history.cpp. References ASSERT. Referenced by Game::back(), Player::getLastRack(), and Player::getLastRound(). |
|
get the size of the history
Definition at line 61 of file history.cpp. Referenced by Game::back(), GamePrintout::DrawPage(), Game::gameSaveFormat_14(), Game::gameSaveFormat_15(), Game::helperPlayRound(), Training::play(), FreeGame::play(), Training::playResult(), and Training::search(). |
|
Get turn 'n'.
Definition at line 87 of file history.cpp. References ASSERT. Referenced by Game::gameSaveFormat_14(), and Game::gameSaveFormat_15(). |
|
Update the "history" with the given round and complete the turn. A new turn is created with the remaining letters in the rack Definition at line 98 of file history.cpp. References Turn::getPlayedRack(), PlayedRack::getRack(), Round::getTile(), Round::getWordLen(), Round::isJoker(), Round::isPlayedFromRack(), Tile::Joker(), Rack::remove(), Turn::setNum(), PlayedRack::setOld(), Turn::setPlayer(), and Turn::setRound(). Referenced by Player::endTurn(), and Game::helperPlayRound(). |
|
Remove last turn.
Definition at line 134 of file history.cpp. References ASSERT, Turn::setNum(), Turn::setPlayer(), and Turn::setRound(). Referenced by Game::back(), and Player::removeLastTurn(). |
|
Set the current rack.
Definition at line 73 of file history.cpp. Referenced by Game::helperPlayRound(), and Player::setCurrentRack(). |
|
String handling.
Definition at line 157 of file history.cpp. Referenced by GameFrame::Refresh(), and Player::toString(). |