Bag: rename a member variable

This commit is contained in:
Olivier Teulière 2013-01-17 17:19:10 +01:00
parent c1c3f3b48b
commit 6dc05081b0
2 changed files with 8 additions and 8 deletions

View file

@ -35,12 +35,12 @@ INIT_LOGGER(game, Bag);
Bag::Bag(const Dictionary &iDic) Bag::Bag(const Dictionary &iDic)
: m_dic(iDic), m_ntiles(0) : m_dic(iDic), m_nbTiles(0)
{ {
BOOST_FOREACH(const Tile &tile, m_dic.getAllTiles()) BOOST_FOREACH(const Tile &tile, m_dic.getAllTiles())
{ {
m_tilesMap[tile] = tile.maxNumber(); m_tilesMap[tile] = tile.maxNumber();
m_ntiles += tile.maxNumber(); m_nbTiles += tile.maxNumber();
} }
} }
@ -88,7 +88,7 @@ void Bag::takeTile(const Tile &iTile)
"The bag does not contain the letter " + lfw(iTile.getDisplayStr())); "The bag does not contain the letter " + lfw(iTile.getDisplayStr()));
m_tilesMap[iTile]--; m_tilesMap[iTile]--;
m_ntiles--; m_nbTiles--;
} }
@ -98,13 +98,13 @@ void Bag::replaceTile(const Tile &iTile)
"Cannot replace tile: " + lfw(iTile.getDisplayStr())); "Cannot replace tile: " + lfw(iTile.getDisplayStr()));
m_tilesMap[iTile]++; m_tilesMap[iTile]++;
m_ntiles++; m_nbTiles++;
} }
Tile Bag::selectRandom() const Tile Bag::selectRandom() const
{ {
return selectRandomTile(m_ntiles, false, false); return selectRandomTile(m_nbTiles, false, false);
} }
@ -145,7 +145,7 @@ Tile Bag::selectRandomTile(unsigned int total,
Bag & Bag::operator=(const Bag &iOther) Bag & Bag::operator=(const Bag &iOther)
{ {
m_tilesMap = iOther.m_tilesMap; m_tilesMap = iOther.m_tilesMap;
m_ntiles = iOther.m_ntiles; m_nbTiles = iOther.m_nbTiles;
return *this; return *this;
} }

View file

@ -53,7 +53,7 @@ public:
* Warning: b.getNbVowels() + b.getNbConsonants() != b.getNbTiles(), * Warning: b.getNbVowels() + b.getNbConsonants() != b.getNbTiles(),
* because of the jokers and the 'Y'. * because of the jokers and the 'Y'.
*/ */
unsigned int getNbTiles() const { return m_ntiles; } unsigned int getNbTiles() const { return m_nbTiles; }
unsigned int getNbVowels() const; unsigned int getNbVowels() const;
unsigned int getNbConsonants() const; unsigned int getNbConsonants() const;
@ -91,7 +91,7 @@ private:
map<Tile, int> m_tilesMap; map<Tile, int> m_tilesMap;
/// Total number of tiles in the bag /// Total number of tiles in the bag
int m_ntiles; int m_nbTiles;
/// Helper method, used by the various selectRandom*() methods /// Helper method, used by the various selectRandom*() methods
Tile selectRandomTile(unsigned int total, Tile selectRandomTile(unsigned int total,