Commit a0243986 authored by Laurent Montel's avatar Laurent Montel 😁

Fix clazy warning

parent d52bf802
...@@ -41,14 +41,14 @@ ChipColor Utils::opponentColorFor(ChipColor color) ...@@ -41,14 +41,14 @@ ChipColor Utils::opponentColorFor(ChipColor color)
} }
QString Utils::colorToString(const ChipColor &color) QString Utils::colorToString(ChipColor color)
{ {
if (Preferences::useColoredChips()) if (Preferences::useColoredChips())
return (color == Black ? i18n("Blue") : i18n("Red")); return (color == Black ? i18n("Blue") : i18n("Red"));
return (color == Black ? i18n("Black") : i18n("White")); return (color == Black ? i18n("Black") : i18n("White"));
} }
QString Utils::moveToString(const KReversiMove& move) QString Utils::moveToString(KReversiMove move)
{ {
QString moveString = colorToString(move.color); QString moveString = colorToString(move.color);
......
...@@ -67,7 +67,7 @@ struct KReversiMove: public KReversiPos { ...@@ -67,7 +67,7 @@ struct KReversiMove: public KReversiPos {
KReversiMove(ChipColor col = NoColor, int r = -1, int c = -1) KReversiMove(ChipColor col = NoColor, int r = -1, int c = -1)
: KReversiPos(r, c), color(col) { } : KReversiPos(r, c), color(col) { }
KReversiMove(ChipColor col, const KReversiPos &pos) KReversiMove(ChipColor col, KReversiPos pos)
: KReversiPos(pos), color(col) { } : KReversiPos(pos), color(col) { }
ChipColor color; ChipColor color;
...@@ -109,11 +109,11 @@ ChipColor opponentColorFor(ChipColor color); ...@@ -109,11 +109,11 @@ ChipColor opponentColorFor(ChipColor color);
/** /**
* @return Human-readable string representing @p color * @return Human-readable string representing @p color
*/ */
QString colorToString(const ChipColor &color); QString colorToString(ChipColor color);
/** /**
* @return Human-readable string representing @p move * @return Human-readable string representing @p move
*/ */
QString moveToString(const KReversiMove& move); QString moveToString(KReversiMove move);
/** /**
* @return Index of current difficulty level in increasing order * @return Index of current difficulty level in increasing order
*/ */
......
...@@ -75,7 +75,7 @@ bool KReversiGame::canUndo() const ...@@ -75,7 +75,7 @@ bool KReversiGame::canUndo() const
return (m_player[m_curPlayer]->isUndoAllowed() && !m_undoStack.isEmpty()); return (m_player[m_curPlayer]->isUndoAllowed() && !m_undoStack.isEmpty());
} }
void KReversiGame::makeMove(const KReversiMove &move) void KReversiGame::makeMove(KReversiMove move)
{ {
if (!move.isValid()) { if (!move.isValid()) {
kickCurrentPlayer(); kickCurrentPlayer();
...@@ -174,7 +174,7 @@ int KReversiGame::undo() ...@@ -174,7 +174,7 @@ int KReversiGame::undo()
return movesUndone; return movesUndone;
} }
void KReversiGame::turnChips(const KReversiMove &move) void KReversiGame::turnChips(KReversiMove move)
{ {
m_changedChips.clear(); m_changedChips.clear();
...@@ -198,7 +198,7 @@ void KReversiGame::turnChips(const KReversiMove &move) ...@@ -198,7 +198,7 @@ void KReversiGame::turnChips(const KReversiMove &move)
m_undoStack.push(m_changedChips); m_undoStack.push(m_changedChips);
} }
bool KReversiGame::isMovePossible(const KReversiMove& move) const bool KReversiGame::isMovePossible(KReversiMove move) const
{ {
// first - the trivial case: // first - the trivial case:
if (m_cells[move.row][move.col] != NoColor || move.color == NoColor) if (m_cells[move.row][move.col] != NoColor || move.color == NoColor)
...@@ -211,7 +211,7 @@ bool KReversiGame::isMovePossible(const KReversiMove& move) const ...@@ -211,7 +211,7 @@ bool KReversiGame::isMovePossible(const KReversiMove& move) const
return false; return false;
} }
bool KReversiGame::hasChunk(int dirNum, const KReversiMove& move) const bool KReversiGame::hasChunk(int dirNum, KReversiMove move) const
{ {
// On each step (as we proceed) we must ensure that current chip is of the // On each step (as we proceed) we must ensure that current chip is of the
// opponent color. // opponent color.
...@@ -367,7 +367,7 @@ int KReversiGame::playerScore(ChipColor player) const ...@@ -367,7 +367,7 @@ int KReversiGame::playerScore(ChipColor player) const
return m_score[player]; return m_score[player];
} }
void KReversiGame::setChipColor(const KReversiMove &move) void KReversiGame::setChipColor(KReversiMove move)
{ {
// first: if the current cell already contains a chip we remove it // first: if the current cell already contains a chip we remove it
if (m_cells[move.row][move.col] != NoColor) if (m_cells[move.row][move.col] != NoColor)
......
...@@ -177,11 +177,11 @@ private: ...@@ -177,11 +177,11 @@ private:
* This will make the player @p move * This will make the player @p move
* If that is possible, of course * If that is possible, of course
*/ */
void makeMove(const KReversiMove &move); void makeMove(KReversiMove move);
/** /**
* This function will tell you if the move is possible. * This function will tell you if the move is possible.
*/ */
bool isMovePossible(const KReversiMove &move) const; bool isMovePossible(KReversiMove move) const;
/** /**
* Searches for "chunk" in direction @p dirNum for @p move. * Searches for "chunk" in direction @p dirNum for @p move.
* As my English-skills are somewhat limited, let me introduce * As my English-skills are somewhat limited, let me introduce
...@@ -191,16 +191,16 @@ private: ...@@ -191,16 +191,16 @@ private:
* CO[O]C <-- this is a chunk * CO[O]C <-- this is a chunk
* where [O] is one or more opponent's pieces * where [O] is one or more opponent's pieces
*/ */
bool hasChunk(int dirNum, const KReversiMove &move) const; bool hasChunk(int dirNum, KReversiMove move) const;
/** /**
* Performs @p move, i.e. marks all the chips that player wins with * Performs @p move, i.e. marks all the chips that player wins with
* this move with current player color * this move with current player color
*/ */
void turnChips(const KReversiMove &move); void turnChips(KReversiMove move);
/** /**
* Sets the type of chip according to @p move * Sets the type of chip according to @p move
*/ */
void setChipColor(const KReversiMove &move); void setChipColor(KReversiMove move);
/** /**
* Delay time * Delay time
*/ */
......
...@@ -41,10 +41,6 @@ ...@@ -41,10 +41,6 @@
#include "kreversicomputerplayer.h" #include "kreversicomputerplayer.h"
#include "kexthighscore.h" #include "kexthighscore.h"
static const int BLACK_STATUSBAR_ID = 1;
static const int WHITE_STATUSBAR_ID = 2;
static const int COMMON_STATUSBAR_ID = 0;
KReversiMainWindow::KReversiMainWindow(QWidget* parent, bool startDemo) KReversiMainWindow::KReversiMainWindow(QWidget* parent, bool startDemo)
: KXmlGuiWindow(parent), : KXmlGuiWindow(parent),
m_startDialog(nullptr), m_startDialog(nullptr),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment