summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Liberty <matt.liberty@gmail.com>2013-11-03 22:43:22 -0800
committerMatt Liberty <matt.liberty@gmail.com>2013-11-03 22:43:22 -0800
commitecae4ba252c9b78d6b4fa6d14d2e694b8f71306a (patch)
treef2a8aaf923a222d223b0d4d86568864c802e2d76
parent29ef933fda48f30a752e2dac2a8cb3f3d0f513b0 (diff)
Make clang happy (for Mavericks)
-rw-r--r--game.cpp32
-rw-r--r--game.h20
-rw-r--r--move.cpp12
-rw-r--r--move.h6
-rw-r--r--player.h4
-rw-r--r--quackleio/dict.cpp10
-rw-r--r--quackleio/dict.h8
7 files changed, 46 insertions, 46 deletions
diff --git a/game.cpp b/game.cpp
index 1e32e61..845e864 100644
--- a/game.cpp
+++ b/game.cpp
@@ -14,7 +14,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
@@ -123,7 +123,7 @@ ComputerPlayer *Game::computerPlayer(int playerId)
{
if (m_computerPlayers.find(playerId) == m_computerPlayers.end())
return defaultComputerPlayer();
-
+
return m_computerPlayers[playerId];
}
@@ -136,7 +136,7 @@ ComputerPlayer *Game::defaultComputerPlayer()
{
if (m_defaultComputerPlayer)
return m_defaultComputerPlayer;
-
+
m_defaultComputerPlayer = new StaticPlayer;
return m_defaultComputerPlayer;
}
@@ -148,7 +148,7 @@ Move Game::haveComputerPlay(ComputerPlayer *computerPlayer)
if (!computerPlayer)
computerPlayer = this->computerPlayer(currentPosition().currentPlayer().id());
-
+
computerPlayer->setPosition(currentPosition());
Move move(computerPlayer->move());
@@ -239,7 +239,7 @@ const GamePosition &GamePosition::operator=(const GamePosition &position)
}
GamePosition::GamePosition()
- : m_currentPlayer(m_players.end()), m_playerOnTurn(m_players.end()), m_turnNumber(0), m_nestedness(0), m_scorelessTurnsInARow(0), m_gameOver(false)
+ : m_currentPlayer(m_players.end()), m_playerOnTurn(m_players.end()), m_turnNumber(0), m_nestedness(0), m_scorelessTurnsInARow(0), m_gameOver(false)
{
setEmptyBoard();
resetMoveMade();
@@ -356,7 +356,7 @@ int GamePosition::validateMove(const Move &move) const
ret |= TooLateExchange;
}
break;
-
+
case Move::UnusedTilesBonus:
case Move::TimePenalty:
ret = InvalidAction;
@@ -384,7 +384,7 @@ bool GamePosition::formsAcceptableWords(const Move &move) const
if (!isAcceptableWord((*it).wordTiles()))
return false;
}
-
+
return true;
}
@@ -506,7 +506,7 @@ Bag GamePosition::unseenBagFromPlayerPerspective(const Player &player) const
ret.toss((*it).rack());
}
}
-
+
return ret;
}
@@ -526,9 +526,9 @@ void GamePosition::ensureProperBag() const
allTiles.toss((*it).rack());
racks.toss((*it).rack());
}
-
+
allTiles.toss(m_bag.shuffledTiles());
-
+
Bag fullDistribution;
bool mismatch = false;
@@ -633,7 +633,7 @@ void GamePosition::setOppRack(const Rack &rack, bool adjustBag)
Rack GamePosition::oppRack()
{
UVcout << "currentPlayer(): " << currentPlayer() << endl;
-
+
const PlayerList::iterator end(m_players.end());
for (PlayerList::iterator it = m_players.begin(); it != end; ++it)
UVcout << "rack " << *it << " " << (*it).rack() << endl;
@@ -682,7 +682,7 @@ bool GamePosition::canSetPlayerRackWithoutBagExpansion(int playerID, const Rack
const PlayerList::const_iterator end(m_players.end());
for (PlayerList::const_iterator it = m_players.begin(); it != end; ++it)
someTiles.toss((*it).rack());
-
+
// Now we have a bag with all tiles not on the board
return someTiles.removeLetters(rack.tiles());
}
@@ -698,7 +698,7 @@ bool GamePosition::setCurrentPlayer(int playerID)
return true;
}
}
-
+
m_currentPlayer = m_players.begin();
return false;
}
@@ -714,7 +714,7 @@ bool GamePosition::setPlayerOnTurn(int playerID)
return true;
}
}
-
+
m_playerOnTurn = m_players.begin();
return false;
}
@@ -1036,7 +1036,7 @@ void GamePosition::adjustScoresToFinishGame()
{
int addand = 0;
LetterString clobberedTiles;
-
+
addand = deadwood(&clobberedTiles);
m_moveMade = Move::createUnusedTilesBonus(clobberedTiles, addand);
@@ -1246,7 +1246,7 @@ HistoryLocation::HistoryLocation(int playerId, int turnNumber)
{
}
-bool operator<(const HistoryLocation &hl1, const HistoryLocation &hl2)
+bool Quackle::operator<(const HistoryLocation &hl1, const HistoryLocation &hl2)
{
if (hl1.turnNumber() != hl2.turnNumber())
return hl1.turnNumber() < hl2.turnNumber();
diff --git a/game.h b/game.h
index edbafb1..40d7600 100644
--- a/game.h
+++ b/game.h
@@ -14,7 +14,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
@@ -39,7 +39,7 @@ class HistoryLocation
{
public:
HistoryLocation(int playerId, int turnNumber);
-
+
int playerId() const;
int turnNumber() const;
@@ -47,7 +47,10 @@ private:
int m_playerId;
int m_turnNumber;
};
-
+
+// comparison based on turn number then player id
+bool operator<(const Quackle::HistoryLocation &hl1, const Quackle::HistoryLocation &hl2);
+
inline int HistoryLocation::playerId() const
{
return m_playerId;
@@ -330,7 +333,7 @@ public:
// return opponent's rack (for preendgame win% usage)
Rack oppRack();
-
+
// if we set player's rack to this, will there be more tiles in
// play than before?
bool canSetCurrentPlayerRackWithoutBagExpansion(const Rack &rack) const;
@@ -410,8 +413,8 @@ protected:
// moves originally from kibitzer
MoveList m_moves;
- // It is very important that these two variables almost always be
- // modified together, unless one is experimenting with different
+ // It is very important that these two variables almost always be
+ // modified together, unless one is experimenting with different
// candidates before deciding on the move to commit.
// For instance, the end-of-game bonus move is stored in both fields.
Move m_moveMade;
@@ -806,7 +809,7 @@ public:
// maintainBoard must be true if you want to keep using this game.
// If the game is over, does nothing.
void commitCandidate(bool maintainBoard = true);
-
+
// convience to set move as candidate and then commit the candidate
void commitMove(const Move &move);
@@ -899,9 +902,6 @@ inline void Game::setTitle(const UVString &title)
}
-// comparison based on turn number then player id
-bool operator<(const Quackle::HistoryLocation &hl1, const Quackle::HistoryLocation &hl2);
-
bool operator==(const Quackle::HistoryLocation &hl1, const Quackle::HistoryLocation &hl2);
UVOStream& operator<<(UVOStream& o, const Quackle::GamePosition &position);
diff --git a/move.cpp b/move.cpp
index 527f96d..eaaf8b6 100644
--- a/move.cpp
+++ b/move.cpp
@@ -14,7 +14,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
@@ -59,7 +59,7 @@ bool operator==(const Move &move1, const Move &move2)
return ret;
}
-bool operator<(const Move &move1, const Move &move2)
+bool Quackle::operator<(const Move &move1, const Move &move2)
{
if (move1.action != move2.action)
return move1.action < move2.action;
@@ -75,7 +75,7 @@ bool operator<(const Move &move1, const Move &move2)
return move1.scoreAddition() < move2.scoreAddition();
if (move1.isChallengedPhoney() != move2.isChallengedPhoney())
return move1.isChallengedPhoney() < move2.isChallengedPhoney();
-
+
return false;
}
@@ -116,7 +116,7 @@ UVString Move::xml() const
bool includeRest = false;
bool includeTiles = false;
bool includeScore = false;
-
+
switch (action)
{
case Pass:
@@ -148,7 +148,7 @@ UVString Move::xml() const
actionString = MARK_UV("place");
UVOStringStream restStream;
-
+
// adding row and column numbers I suppose is bloat
//restStream << "position=\"" << positionString() << "\" startrow=\"" << startrow << "\" startcolumn=\"" << startcol << "\"";
restStream << "position=\"" << positionString() << "\"";
@@ -441,7 +441,7 @@ bool MoveList::scoreComparator(const Move &move1, const Move &move2)
}
return move1.effectiveScore() < move2.effectiveScore();
}
-
+
bool MoveList::alphabeticalComparator(const Move &move1, const Move &move2)
{
if (move1.tiles() == move2.tiles()) {
diff --git a/move.h b/move.h
index 6f9b28d..6ddca58 100644
--- a/move.h
+++ b/move.h
@@ -139,6 +139,9 @@ private:
int m_scoreAddition;
};
+// comparison based on action, then tiles, then horizontalness, then startrow, then endcol
+bool operator<(const Quackle::Move &move1, const Quackle::Move &move2);
+
class MoveList : public vector<Move>
{
public:
@@ -226,9 +229,6 @@ inline bool Move::isAlreadyOnBoard(Letter letter)
// are equal
bool operator==(const Quackle::Move &move1, const Quackle::Move &move2);
-// comparison based on action, then tiles, then horizontalness, then startrow, then endcol
-bool operator<(const Quackle::Move &move1, const Quackle::Move &move2);
-
UVOStream& operator<<(UVOStream& o, const Quackle::Move& m);
UVOStream& operator<<(UVOStream& o, const Quackle::MoveList& moves);
diff --git a/player.h b/player.h
index 0c369c8..cffe205 100644
--- a/player.h
+++ b/player.h
@@ -100,14 +100,14 @@ private:
bool m_racksAreKnown;
};
-}
-
// comparison based on player ID
inline bool operator<(const Quackle::Player &player1, const Quackle::Player &player2)
{
return player1.id() < player2.id();
}
+}
+
inline bool operator==(const Quackle::Player &player1, const Quackle::Player &player2)
{
return player1.id() == player2.id();
diff --git a/quackleio/dict.cpp b/quackleio/dict.cpp
index e949ef0..8a59a76 100644
--- a/quackleio/dict.cpp
+++ b/quackleio/dict.cpp
@@ -14,7 +14,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
@@ -42,7 +42,7 @@ void WordList::setSortBy(SortType _sortType)
sortType = _sortType;
}
-bool operator<(const Dict::Word &word1, const Dict::Word &word2)
+bool Dict::operator<(const Dict::Word &word1, const Dict::Word &word2)
{
switch (Dict::WordList::sortType)
{
@@ -52,15 +52,15 @@ bool operator<(const Dict::Word &word1, const Dict::Word &word2)
case Dict::WordList::Playability:
if (word1.playability != word2.playability)
return word1.playability > word2.playability;
-
+
if (word1.word.length() != word2.word.length())
return word1.word.length() < word2.word.length();
// fall through
-
+
case Dict::WordList::Probability:
return word1.probability > word2.probability;
-
+
case Dict::WordList::Length:
case Dict::WordList::LengthLongestFirst:
{
diff --git a/quackleio/dict.h b/quackleio/dict.h
index 4935e4b..49b9286 100644
--- a/quackleio/dict.h
+++ b/quackleio/dict.h
@@ -55,6 +55,10 @@ private:
ExtensionList getExtensionList(bool front) const;
};
+// Returns true if word1 is less playable than word2;
+// otherwise returns false.
+bool operator<(const Dict::Word &word1, const Dict::Word &word2);
+
class WordList : public QList<Word>
{
public:
@@ -84,8 +88,4 @@ public:
}
-// Returns true if word1 is less playable than word2;
-// otherwise returns false.
-bool operator<(const Dict::Word &word1, const Dict::Word &word2);
-
#endif