diff --git a/game/game.h b/game/game.h index 5486d25..bbd4869 100644 --- a/game/game.h +++ b/game/game.h @@ -37,7 +37,7 @@ class Player; class PlayedRack; class Round; class Rack; -class Turn; +class TurnData; using namespace std; diff --git a/game/history.cpp b/game/history.cpp index c36e09f..72c74be 100644 --- a/game/history.cpp +++ b/game/history.cpp @@ -36,7 +36,7 @@ INIT_LOGGER(game, History); History::History() { - Turn* t = new Turn(); + TurnData *t = new TurnData(); m_history.clear(); m_history.push_back(t); } @@ -44,7 +44,7 @@ History::History() History::~History() { - BOOST_FOREACH(Turn *turn, m_history) + BOOST_FOREACH(TurnData *turn, m_history) { delete turn; } @@ -70,7 +70,7 @@ void History::setCurrentRack(const PlayedRack &iPld) } -const Turn& History::getPreviousTurn() const +const TurnData& History::getPreviousTurn() const { int idx = m_history.size() - 2; ASSERT(0 <= idx , "No previous turn"); @@ -78,7 +78,7 @@ const Turn& History::getPreviousTurn() const } -const Turn& History::getTurn(unsigned int n) const +const TurnData& History::getTurn(unsigned int n) const { ASSERT(n < m_history.size(), "Wrong turn number"); return *(m_history[n]); @@ -100,14 +100,14 @@ void History::playMove(unsigned int iPlayer, const Move &iMove, const PlayedRack &iNewRack) { - Turn * current_turn = m_history.back(); + TurnData * current_turn = m_history.back(); // Set the number and the round current_turn->setPlayer(iPlayer); current_turn->setMove(iMove); // Create a new turn - Turn * next_turn = new Turn(); + TurnData * next_turn = new TurnData(); next_turn->setPlayedRack(iNewRack); m_history.push_back(next_turn); } @@ -120,13 +120,13 @@ void History::removeLastTurn() if (idx > 1) { - Turn *t = m_history.back(); + TurnData *t = m_history.back(); m_history.pop_back(); delete t; } // Now we have the previous played round in back() - Turn *t = m_history.back(); + TurnData *t = m_history.back(); t->setPlayer(0); //t->setRound(Round()); #ifdef BACK_REMOVE_RACK_NEW_PART @@ -178,7 +178,7 @@ wstring History::toString() const _swprintf(buff, 4, L"%ld", m_history.size()); rs = L"history size = " + wstring(buff) + L"\n\n"; #endif - BOOST_FOREACH(const Turn *turn, m_history) + BOOST_FOREACH(const TurnData *turn, m_history) { rs += turn->toString() + L"\n"; } diff --git a/game/history.h b/game/history.h index 21d89fa..78d9cb5 100644 --- a/game/history.h +++ b/game/history.h @@ -31,7 +31,7 @@ using std::wstring; using std::vector; class Move; -class Turn; +class TurnData; class PlayedRack; /** @@ -40,7 +40,7 @@ class PlayedRack; * - one for the complete game * - one for each player * - * The top of the history is an empty Turn until it has been filled + * The top of the history is an empty TurnData until it has been filled * and the game is up to a new turn. So a History object is never empty. * However, the getSize() method only returns the number of complete * turns, and can therefore return 0. @@ -69,10 +69,10 @@ public: void setCurrentRack(const PlayedRack &iPld); /// Get the previous (complete) turn - const Turn& getPreviousTurn() const; + const TurnData& getPreviousTurn() const; /// Get turn 'n' (starting at 0) - const Turn& getTurn(unsigned int) const; + const TurnData& getTurn(unsigned int) const; /** * Return true if the history doesn't contain at least one move @@ -102,7 +102,7 @@ public: wstring toString() const; private: - vector m_history; + vector m_history; }; #endif diff --git a/game/player.h b/game/player.h index bc36057..a6c6d58 100644 --- a/game/player.h +++ b/game/player.h @@ -30,7 +30,7 @@ using std::wstring; -class Turn; +class TurnData; class Rack; diff --git a/game/turn_data.cpp b/game/turn_data.cpp index a95e278..5b22448 100644 --- a/game/turn_data.cpp +++ b/game/turn_data.cpp @@ -24,19 +24,19 @@ #include "turn_data.h" -INIT_LOGGER(game, Turn); +INIT_LOGGER(game, TurnData); // FIXME: move set to an arbitrary one (no move). It would be better to get rid of this // constructor completely -Turn::Turn() +TurnData::TurnData() : m_playerId(0), m_warningsNb(0), m_penaltyPoints(0), m_soloPoints(0), m_endGamePoints(0) { } -Turn::Turn(unsigned int iPlayerId, const PlayedRack& iPldRack, +TurnData::TurnData(unsigned int iPlayerId, const PlayedRack& iPldRack, const Move& iMove) : m_playerId(iPlayerId), m_pldrack(iPldRack), m_move(iMove), m_warningsNb(0), m_penaltyPoints(0), m_soloPoints(0), m_endGamePoints(0) @@ -44,7 +44,7 @@ Turn::Turn(unsigned int iPlayerId, const PlayedRack& iPldRack, } -wstring Turn::toString() const +wstring TurnData::toString() const { wostringstream oss; oss << m_pldrack.toString() << L" " << m_move.toString() diff --git a/game/turn_data.h b/game/turn_data.h index ce21e01..df677a5 100644 --- a/game/turn_data.h +++ b/game/turn_data.h @@ -19,8 +19,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *****************************************************************************/ -#ifndef TURN_H_ -#define TURN_H_ +#ifndef TURN_DATA_H_ +#define TURN_DATA_H_ #include #include "pldrack.h" @@ -31,19 +31,19 @@ using std::wstring; /** - * A Turn is the information about one 'move' done by a player. + * A TurnData is the information about one 'move' done by a player. * It consists of the player who played, the rack, and the actual move. * * This class has no logic, it is merely there to aggregate corresponding * data. */ -class Turn +class TurnData { DEFINE_LOGGER(); public: - Turn(); - Turn(unsigned int iPlayerId, - const PlayedRack& iPldRack, const Move& iMove); + TurnData(); + TurnData(unsigned int iPlayerId, + const PlayedRack& iPldRack, const Move& iMove); void setPlayer(unsigned int iPlayerId) { m_playerId = iPlayerId; } void setPlayedRack(const PlayedRack& iPldRack) { m_pldrack = iPldRack; } diff --git a/qt/history_widget.cpp b/qt/history_widget.cpp index 426b6c0..68b7736 100644 --- a/qt/history_widget.cpp +++ b/qt/history_widget.cpp @@ -168,7 +168,7 @@ void HistoryWidget::updateModel() QColor color = Qt::black; - const Turn& t = m_history->getTurn(i); + const TurnData& t = m_history->getTurn(i); const Move& m = t.getMove(); // Set data common to all moves diff --git a/qt/main_window.cpp b/qt/main_window.cpp index 1caef40..c75ad5e 100644 --- a/qt/main_window.cpp +++ b/qt/main_window.cpp @@ -950,7 +950,7 @@ void MainWindow::onGamePrint() nextHeight = curHeight + LINE_HEIGHT; for (unsigned int i = 0; i < history.getSize(); ++i) { - const Turn &t = history.getTurn(i); + const TurnData &t = history.getTurn(i); const Move &m = t.getMove(); curWidth = TEXT_OFFSET; diff --git a/qt/stats_widget.cpp b/qt/stats_widget.cpp index 18e1ed4..da85774 100644 --- a/qt/stats_widget.cpp +++ b/qt/stats_widget.cpp @@ -281,7 +281,7 @@ void StatsWidget::setModelText(const QModelIndex &iIndex, void StatsWidget::setModelTurnData(const QModelIndex &iIndex, - const Turn &iTurn, const Turn &iGameTurn) + const TurnData &iTurn, const TurnData &iGameTurn) { // Set the text (score for the turn) if (!iTurn.getMove().isNull()) @@ -327,7 +327,7 @@ void StatsWidget::setModelEventData(const QModelIndex &iIndex, } -QString StatsWidget::getTooltip(const Turn &iTurn, const Turn &iGameTurn) const +QString StatsWidget::getTooltip(const TurnData &iTurn, const TurnData &iGameTurn) const { QString tooltip = _q("Rack: %1").arg(qfw(iTurn.getPlayedRack().toString())); const Move &move = iTurn.getMove(); diff --git a/qt/stats_widget.h b/qt/stats_widget.h index 71abf0f..c1bd167 100644 --- a/qt/stats_widget.h +++ b/qt/stats_widget.h @@ -28,7 +28,7 @@ class PublicGame; class Player; -class Turn; +class TurnData; class QTableView; class QStandardItemModel; class QVariant; @@ -70,7 +70,7 @@ private: QModelIndex getIndex(int row, int col) const; - QString getTooltip(const Turn &iTurn, const Turn &iGameTurn) const; + QString getTooltip(const TurnData &iTurn, const TurnData &iGameTurn) const; void setSectionHidden(int index, bool iHide); void setModelSize(int rowCount, int colCount); @@ -78,7 +78,7 @@ private: void setModelText(const QModelIndex &iIndex, const QVariant &iData, bool useBoldFont = false); void setModelTurnData(const QModelIndex &iIndex, - const Turn &iTurn, const Turn &iGameTurn); + const TurnData &iTurn, const TurnData &iGameTurn); void setModelEventData(const QModelIndex &iIndex, int iEvent, const Player &iPlayer); }; diff --git a/utils/game_io.cpp b/utils/game_io.cpp index 695e992..f92f800 100644 --- a/utils/game_io.cpp +++ b/utils/game_io.cpp @@ -233,7 +233,7 @@ void GameIO::printGameDebug(ostream &out, const PublicGame &iGame) out << " ===|===|==========|================|=====|=====|======" << endl; for (unsigned int i = 0; i < iGame.getHistory().getSize(); ++i) { - const Turn &turn = iGame.getHistory().getTurn(i); + const TurnData &turn = iGame.getHistory().getTurn(i); const Move &move = turn.getMove(); format fmter("%1% | %2% | %3% | %4% | %5% | %6% | %7%"); fmter % padAndConvert(str(wformat(L"%1%") % (i + 1)), 5); diff --git a/utils/ncurses.cpp b/utils/ncurses.cpp index 2e84d08..f81017d 100644 --- a/utils/ncurses.cpp +++ b/utils/ncurses.cpp @@ -395,7 +395,7 @@ void CursesIntf::drawHistory(Box &ioBox) const for (i = ioBox.getFirstLine(); i < (int)m_game->getHistory().getSize() && i < ioBox.getLastLine(); i++) { - const Turn& t = m_game->getHistory().getTurn(i); + const TurnData& t = m_game->getHistory().getTurn(i); const Move& m = t.getMove(); if (m.isValid()) {