Rack: rename a method

This commit is contained in:
Olivier Teulière 2013-01-17 17:55:00 +01:00
parent ac3cc02be4
commit b493b3b365
6 changed files with 11 additions and 11 deletions

View file

@ -136,11 +136,11 @@ void BoardSearch::leftPart(Rack &iRack, Round &ioPartialWord,
if (iLimit > 0)
{
bool hasJokerInRack = iRack.in(Tile::Joker());
bool hasJokerInRack = iRack.count(Tile::Joker());
for (unsigned int succ = m_dic.getSucc(n); succ; succ = m_dic.getNext(succ))
{
const Tile &l = Tile(m_dic.getChar(succ));
if (iRack.in(l))
if (iRack.count(l))
{
iRack.remove(l);
ioPartialWord.addRightFromRack(l, false);
@ -182,13 +182,13 @@ void BoardSearch::extendRight(Rack &iRack, Round &ioPartialWord,
if (m_crossMx[iRow][iCol].isNone())
return;
bool hasJokerInRack = iRack.in(Tile::Joker());
bool hasJokerInRack = iRack.count(Tile::Joker());
for (unsigned int succ = m_dic.getSucc(iNode); succ; succ = m_dic.getNext(succ))
{
const Tile &l = Tile(m_dic.getChar(succ));
if (m_crossMx[iRow][iCol].check(l))
{
if (iRack.in(l))
if (iRack.count(l))
{
iRack.remove(l);
ioPartialWord.addRightFromRack(l, false);

View file

@ -270,7 +270,7 @@ int FreeGame::checkPass(const Player &iPlayer,
BOOST_FOREACH(wchar_t wch, iToChange)
{
// Remove the letter from the rack
if (!rack.in(Tile(wch)))
if (!rack.count(Tile(wch)))
{
return 2;
}

View file

@ -497,7 +497,7 @@ PlayedRack Game::helperSetRackRandom(const PlayedRack &iPld,
// We need to swap the joker (it is necessarily in the
// new tiles, because jokerAdded is true)
Rack tmpRack = pld.getNew();
ASSERT(tmpRack.in(Tile::Joker()), "No joker found in the new tiles");
ASSERT(tmpRack.count(Tile::Joker()), "No joker found in the new tiles");
tmpRack.remove(Tile::Joker());
tmpRack.add(replacingTile);
pld.setNew(tmpRack);
@ -525,7 +525,7 @@ bool Game::rackInBag(const Rack &iRack, const Bag &iBag) const
{
BOOST_FOREACH(const Tile &t, getDic().getAllTiles())
{
if (iRack.in(t) > iBag.count(t))
if (iRack.count(t) > iBag.count(t))
return false;
}
return true;
@ -678,7 +678,7 @@ int Game::checkPlayedWord(const wstring &iCoord,
else
t = round.getTile(i);
if (!rack.in(t))
if (!rack.count(t))
{
return 4;
}

View file

@ -36,7 +36,7 @@ Rack::Rack()
void Rack::remove(const Tile &t)
{
ASSERT(in(t),
ASSERT(count(t),
"The rack does not contain the letter " + lfw(t.getDisplayStr()));
m_tiles[t.toCode()]--;
m_nbTiles--;

View file

@ -44,7 +44,7 @@ public:
unsigned getNbTiles() const { return m_nbTiles; }
bool isEmpty() const { return getNbTiles() == 0; }
unsigned in(const Tile &t) const { return m_tiles[t.toCode()]; }
unsigned count(const Tile &t) const { return m_tiles[t.toCode()]; }
void add(const Tile &t) { m_tiles[t.toCode()]++; m_nbTiles++; }
void remove(const Tile &t);
void clear();

View file

@ -201,7 +201,7 @@ void BagWidget2::refresh()
BOOST_FOREACH(const Tile &tile, m_game->getDic().getAllTiles())
{
const unsigned int nbInBag = bag.count(tile);
const unsigned int nbInRack = rack.in(tile);
const unsigned int nbInRack = rack.count(tile);
ASSERT(nbInBag >= nbInRack, "Unexpected letters in the rack");
for (unsigned i = 0; i < nbInBag - nbInRack; ++i)
{