mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-01-18 10:26:15 +01:00
- Removed the RACK_MANUAL enum value, and the obsolete Training::setRack() method
- qt/board_widget.cpp: cosmetics
This commit is contained in:
parent
a4ae71d55d
commit
229f1fcc14
5 changed files with 10 additions and 39 deletions
|
@ -118,9 +118,6 @@ void Game::realBag(Bag &ioBag) const
|
|||
PlayedRack Game::helperSetRackRandom(const PlayedRack &iPld,
|
||||
bool iCheck, set_rack_mode mode) const
|
||||
{
|
||||
// FIXME: RACK_MANUAL shouldn't be in the enum
|
||||
ASSERT(mode != RACK_MANUAL, "Invalid rack mode");
|
||||
|
||||
// When iCheck is true, we must make sure that there are at least 2 vowels
|
||||
// and 2 consonants in the rack up to the 15th turn, and at least one of
|
||||
// each starting from the 16th turn.
|
||||
|
|
|
@ -206,7 +206,7 @@ public:
|
|||
* Setting the rack
|
||||
***************/
|
||||
|
||||
enum set_rack_mode {RACK_ALL, RACK_NEW, RACK_MANUAL};
|
||||
enum set_rack_mode {RACK_ALL, RACK_NEW};
|
||||
|
||||
void addPoints(int iPoints) { m_points += iPoints; }
|
||||
|
||||
|
|
|
@ -84,25 +84,6 @@ int Training::setRackManual(bool iCheck, const wstring &iLetters)
|
|||
}
|
||||
|
||||
|
||||
int Training::setRack(set_rack_mode iMode, bool iCheck, const wstring &iLetters)
|
||||
{
|
||||
int res = 0;
|
||||
switch(iMode)
|
||||
{
|
||||
case RACK_MANUAL:
|
||||
res = setRackManual(iCheck, iLetters);
|
||||
break;
|
||||
case RACK_ALL:
|
||||
setRackRandom(iCheck, iMode);
|
||||
break;
|
||||
case RACK_NEW:
|
||||
setRackRandom(iCheck, iMode);
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
int Training::play(const wstring &iCoord, const wstring &iWord)
|
||||
{
|
||||
// Perform all the validity checks, and fill a round
|
||||
|
|
|
@ -70,11 +70,6 @@ public:
|
|||
|
||||
int setRackManual(bool iCheck, const wstring &iLetters);
|
||||
|
||||
/**
|
||||
* @Deprecated: use setRackRandom() or setRackManual() instead.
|
||||
*/
|
||||
int setRack(set_rack_mode iMode, bool iCheck, const wstring &iLetters);
|
||||
|
||||
/*************************
|
||||
* Override the default behaviour of addPlayer(), because in training
|
||||
* mode we only want a human player
|
||||
|
|
|
@ -97,6 +97,9 @@ void BoardWidget::paintEvent(QPaintEvent *)
|
|||
{
|
||||
for (unsigned int col = BOARD_MIN; col <= BOARD_MAX; ++col)
|
||||
{
|
||||
const unsigned int xPos = (col - BOARD_MIN + 1) * squareSize;
|
||||
const unsigned int yPos = (row - BOARD_MIN + 1) * squareSize;
|
||||
|
||||
// Set the brush color
|
||||
if (m_game != NULL && !m_game->getBoard().getTile(row, col).isEmpty())
|
||||
{
|
||||
|
@ -115,9 +118,7 @@ void BoardWidget::paintEvent(QPaintEvent *)
|
|||
painter.setBrush(L2Colour);
|
||||
else
|
||||
painter.setBrush(EmptyColour);
|
||||
painter.drawRect((col - BOARD_MIN + 1) * squareSize,
|
||||
(row - BOARD_MIN + 1) * squareSize,
|
||||
squareSize, squareSize);
|
||||
painter.drawRect(xPos, yPos, squareSize, squareSize);
|
||||
|
||||
// Draw the letter
|
||||
if (m_game != NULL && !m_game->getBoard().getTile(row, col).isEmpty())
|
||||
|
@ -126,11 +127,8 @@ void BoardWidget::paintEvent(QPaintEvent *)
|
|||
if (m_game->getBoard().getCharAttr(row, col) & ATTR_JOKER)
|
||||
painter.setPen(JokerColour);
|
||||
painter.setFont(letterFont);
|
||||
painter.drawText((col - BOARD_MIN + 1) * squareSize,
|
||||
(row - BOARD_MIN + 1) * squareSize + 1,
|
||||
squareSize, squareSize,
|
||||
Qt::AlignCenter,
|
||||
qfw(wstring(1, chr)));
|
||||
painter.drawText(xPos, yPos + 1, squareSize, squareSize,
|
||||
Qt::AlignCenter, qfw(wstring(1, chr)));
|
||||
painter.setPen(NormalColour);
|
||||
|
||||
// Draw the points of the tile
|
||||
|
@ -138,8 +136,8 @@ void BoardWidget::paintEvent(QPaintEvent *)
|
|||
!m_game->getBoard().getCharAttr(row, col) & ATTR_JOKER)
|
||||
{
|
||||
painter.setFont(pointsFont);
|
||||
painter.drawText((col - BOARD_MIN + 1) * squareSize + squareSize * (1 - pointsCoeff),
|
||||
(row - BOARD_MIN + 1) * squareSize + squareSize * (1 - pointsCoeff) + 1,
|
||||
painter.drawText(xPos + squareSize * (1 - pointsCoeff),
|
||||
yPos + squareSize * (1 - pointsCoeff) + 1,
|
||||
squareSize * pointsCoeff, squareSize * pointsCoeff + 3,
|
||||
Qt::AlignRight | Qt::AlignBottom,
|
||||
QString("%1").arg(m_game->getBoard().getTile(row, col).getPoints()));
|
||||
|
@ -148,9 +146,9 @@ void BoardWidget::paintEvent(QPaintEvent *)
|
|||
}
|
||||
}
|
||||
// Draw the coordinates
|
||||
painter.setFont(letterFont);
|
||||
for (unsigned x = 1; x <= BOARD_MAX - BOARD_MIN + 1; ++x)
|
||||
{
|
||||
painter.setFont(letterFont);
|
||||
painter.drawText(x * squareSize, 1,
|
||||
squareSize, squareSize,
|
||||
Qt::AlignCenter,
|
||||
|
|
Loading…
Reference in a new issue