diff --git a/game/game.h b/game/game.h index 16c2fb0..f950121 100644 --- a/game/game.h +++ b/game/game.h @@ -133,7 +133,7 @@ public: * Methods to access already played words. * The int parameter should be 0 <= int < getNTurns() */ - const History& getHistory() { return m_history; } + const History& getHistory() const { return m_history; } /** * Methods to access players. diff --git a/game/history.cpp b/game/history.cpp index d34a56a..8241835 100644 --- a/game/history.cpp +++ b/game/history.cpp @@ -60,7 +60,7 @@ History::~History() int History::getSize() const { - return m_history.size(); + return m_history.size() - 1; } @@ -79,7 +79,7 @@ void History::setCurrentRack(const PlayedRack &iPld) const Turn& History::getPreviousTurn() const { int idx = m_history.size() - 2; - ASSERT(0 <= idx , "Wrong turn number"); + ASSERT(0 <= idx , "No previous turn"); return *(m_history[idx]); } diff --git a/game/history.h b/game/history.h index 00d5c07..22c4472 100644 --- a/game/history.h +++ b/game/history.h @@ -28,10 +28,9 @@ #define _HISTORY_H #include - -class Turn; -class PlayedRack; -class Round; +#include "pldrack.h" +#include "round.h" +#include "turn.h" /** * History stores all the turns that have been played @@ -39,9 +38,11 @@ class Round; * - one for the complete game * - one for each of the players * - * A History is never empty (getSize() can be used as the is the current turn + * 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. * diff --git a/game/results.cpp b/game/results.cpp index 6ec5735..4563295 100644 --- a/game/results.cpp +++ b/game/results.cpp @@ -58,8 +58,7 @@ void Results::search(const Dictionary &iDic, Board &iBoard, { clear(); - /* we start at round 1 */ - if (iTurn == 1) + if (iTurn == 0) { iBoard.searchFirst(iDic, iRack, *this); }