[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Eliot-dev] eliot game/game.cpp game/game.h game/training.c...
From: |
Olivier Teulière |
Subject: |
[Eliot-dev] eliot game/game.cpp game/game.h game/training.c... |
Date: |
Sun, 11 Jan 2009 14:20:37 +0000 |
CVSROOT: /cvsroot/eliot
Module name: eliot
Changes by: Olivier Teulière <ipkiss> 09/01/11 14:20:37
Modified files:
game : game.cpp game.h training.cpp training.h
qt : board_widget.cpp
Log message:
- Removed the RACK_MANUAL enum value, and the obsolete
Training::setRack() method
- qt/board_widget.cpp: cosmetics
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/game/game.cpp?cvsroot=eliot&r1=1.50&r2=1.51
http://cvs.savannah.gnu.org/viewcvs/eliot/game/game.h?cvsroot=eliot&r1=1.45&r2=1.46
http://cvs.savannah.gnu.org/viewcvs/eliot/game/training.cpp?cvsroot=eliot&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/eliot/game/training.h?cvsroot=eliot&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/board_widget.cpp?cvsroot=eliot&r1=1.8&r2=1.9
Patches:
Index: game/game.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/game/game.cpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- game/game.cpp 30 Nov 2008 21:07:19 -0000 1.50
+++ game/game.cpp 11 Jan 2009 14:20:35 -0000 1.51
@@ -118,9 +118,6 @@
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.
Index: game/game.h
===================================================================
RCS file: /cvsroot/eliot/eliot/game/game.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- game/game.h 30 Nov 2008 21:07:19 -0000 1.45
+++ game/game.h 11 Jan 2009 14:20:35 -0000 1.46
@@ -206,7 +206,7 @@
* 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; }
Index: game/training.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/game/training.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- game/training.cpp 30 Nov 2008 20:55:46 -0000 1.29
+++ game/training.cpp 11 Jan 2009 14:20:36 -0000 1.30
@@ -84,25 +84,6 @@
}
-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
Index: game/training.h
===================================================================
RCS file: /cvsroot/eliot/eliot/game/training.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- game/training.h 30 Nov 2008 20:51:42 -0000 1.21
+++ game/training.h 11 Jan 2009 14:20:36 -0000 1.22
@@ -70,11 +70,6 @@
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
Index: qt/board_widget.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/board_widget.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- qt/board_widget.cpp 4 Jan 2009 17:39:27 -0000 1.8
+++ qt/board_widget.cpp 11 Jan 2009 14:20:37 -0000 1.9
@@ -97,6 +97,9 @@
{
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 @@
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 @@
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 @@
!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 @@
}
}
// 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,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Eliot-dev] eliot game/game.cpp game/game.h game/training.c...,
Olivier Teulière <=