mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-01-29 20:34:56 +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,
|
PlayedRack Game::helperSetRackRandom(const PlayedRack &iPld,
|
||||||
bool iCheck, set_rack_mode mode) const
|
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
|
// 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
|
// and 2 consonants in the rack up to the 15th turn, and at least one of
|
||||||
// each starting from the 16th turn.
|
// each starting from the 16th turn.
|
||||||
|
|
|
@ -206,7 +206,7 @@ public:
|
||||||
* Setting the rack
|
* 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; }
|
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)
|
int Training::play(const wstring &iCoord, const wstring &iWord)
|
||||||
{
|
{
|
||||||
// Perform all the validity checks, and fill a round
|
// Perform all the validity checks, and fill a round
|
||||||
|
|
|
@ -70,11 +70,6 @@ public:
|
||||||
|
|
||||||
int setRackManual(bool iCheck, const wstring &iLetters);
|
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
|
* Override the default behaviour of addPlayer(), because in training
|
||||||
* mode we only want a human player
|
* 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)
|
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
|
// Set the brush color
|
||||||
if (m_game != NULL && !m_game->getBoard().getTile(row, col).isEmpty())
|
if (m_game != NULL && !m_game->getBoard().getTile(row, col).isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -115,9 +118,7 @@ void BoardWidget::paintEvent(QPaintEvent *)
|
||||||
painter.setBrush(L2Colour);
|
painter.setBrush(L2Colour);
|
||||||
else
|
else
|
||||||
painter.setBrush(EmptyColour);
|
painter.setBrush(EmptyColour);
|
||||||
painter.drawRect((col - BOARD_MIN + 1) * squareSize,
|
painter.drawRect(xPos, yPos, squareSize, squareSize);
|
||||||
(row - BOARD_MIN + 1) * squareSize,
|
|
||||||
squareSize, squareSize);
|
|
||||||
|
|
||||||
// Draw the letter
|
// Draw the letter
|
||||||
if (m_game != NULL && !m_game->getBoard().getTile(row, col).isEmpty())
|
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)
|
if (m_game->getBoard().getCharAttr(row, col) & ATTR_JOKER)
|
||||||
painter.setPen(JokerColour);
|
painter.setPen(JokerColour);
|
||||||
painter.setFont(letterFont);
|
painter.setFont(letterFont);
|
||||||
painter.drawText((col - BOARD_MIN + 1) * squareSize,
|
painter.drawText(xPos, yPos + 1, squareSize, squareSize,
|
||||||
(row - BOARD_MIN + 1) * squareSize + 1,
|
Qt::AlignCenter, qfw(wstring(1, chr)));
|
||||||
squareSize, squareSize,
|
|
||||||
Qt::AlignCenter,
|
|
||||||
qfw(wstring(1, chr)));
|
|
||||||
painter.setPen(NormalColour);
|
painter.setPen(NormalColour);
|
||||||
|
|
||||||
// Draw the points of the tile
|
// Draw the points of the tile
|
||||||
|
@ -138,8 +136,8 @@ void BoardWidget::paintEvent(QPaintEvent *)
|
||||||
!m_game->getBoard().getCharAttr(row, col) & ATTR_JOKER)
|
!m_game->getBoard().getCharAttr(row, col) & ATTR_JOKER)
|
||||||
{
|
{
|
||||||
painter.setFont(pointsFont);
|
painter.setFont(pointsFont);
|
||||||
painter.drawText((col - BOARD_MIN + 1) * squareSize + squareSize * (1 - pointsCoeff),
|
painter.drawText(xPos + squareSize * (1 - pointsCoeff),
|
||||||
(row - BOARD_MIN + 1) * squareSize + squareSize * (1 - pointsCoeff) + 1,
|
yPos + squareSize * (1 - pointsCoeff) + 1,
|
||||||
squareSize * pointsCoeff, squareSize * pointsCoeff + 3,
|
squareSize * pointsCoeff, squareSize * pointsCoeff + 3,
|
||||||
Qt::AlignRight | Qt::AlignBottom,
|
Qt::AlignRight | Qt::AlignBottom,
|
||||||
QString("%1").arg(m_game->getBoard().getTile(row, col).getPoints()));
|
QString("%1").arg(m_game->getBoard().getTile(row, col).getPoints()));
|
||||||
|
@ -148,9 +146,9 @@ void BoardWidget::paintEvent(QPaintEvent *)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Draw the coordinates
|
// Draw the coordinates
|
||||||
|
painter.setFont(letterFont);
|
||||||
for (unsigned x = 1; x <= BOARD_MAX - BOARD_MIN + 1; ++x)
|
for (unsigned x = 1; x <= BOARD_MAX - BOARD_MIN + 1; ++x)
|
||||||
{
|
{
|
||||||
painter.setFont(letterFont);
|
|
||||||
painter.drawText(x * squareSize, 1,
|
painter.drawText(x * squareSize, 1,
|
||||||
squareSize, squareSize,
|
squareSize, squareSize,
|
||||||
Qt::AlignCenter,
|
Qt::AlignCenter,
|
||||||
|
|
Loading…
Add table
Reference in a new issue