Correctly retrieve the game rack

This commit is contained in:
Olivier Teulière 2012-02-25 23:33:10 +01:00
parent 4077a25fa0
commit 22fd6484f3
4 changed files with 6 additions and 6 deletions

View file

@ -33,6 +33,7 @@ using std::vector;
class Move;
class Turn;
class PlayedRack;
class Rack;
/**
* History stores all the turns that have been played

View file

@ -117,8 +117,7 @@ void BagWidget2::refresh()
m_tilesVect.push_back(tileWidget);
}
// XXX: ugly (and wrong) way to get the rack
const Rack &rack = m_game->getCurrentPlayer().getCurrentRack().getRack();
const Rack &rack = m_game->getHistory().getCurrentRack().getRack();
TileWidget::State previewState =
m_showTilesInRack ? TileWidget::PREVIEW : TileWidget::NORMAL;

View file

@ -26,7 +26,7 @@
#include "qtcommon.h"
#include "public_game.h"
#include "player.h"
#include "history.h"
#include "pldrack.h"
#include "debug.h"
@ -65,9 +65,9 @@ void RackWidget::refresh()
if (m_game == NULL)
return;
// XXX: ugly (and wrong) way to get the rack
// Get the rack
vector<Tile> tiles;
m_game->getCurrentPlayer().getCurrentRack().getAllTiles(tiles);
m_game->getHistory().getCurrentRack().getAllTiles(tiles);
// Make sure we have as many widgets as there are letters in the rack
while (m_tilesVect.size() > tiles.size())

View file

@ -215,7 +215,7 @@ void GameIO::printNonPlayed(ostream &out, const PublicGame &iGame)
void GameIO::printPlayedRack(ostream &out, const PublicGame &iGame, int __UNUSED__ n)
{
out << lfw(iGame.getCurrentPlayer().getCurrentRack().toString(PlayedRack::RACK_SIMPLE)) << endl;
out << lfw(iGame.getHistory().getCurrentRack().toString(PlayedRack::RACK_SIMPLE)) << endl;
}