mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-01-13 20:03:23 +01:00
Bag: rename a member variable
This commit is contained in:
parent
c1c3f3b48b
commit
6dc05081b0
2 changed files with 8 additions and 8 deletions
12
game/bag.cpp
12
game/bag.cpp
|
@ -35,12 +35,12 @@ INIT_LOGGER(game, Bag);
|
|||
|
||||
|
||||
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())
|
||||
{
|
||||
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()));
|
||||
|
||||
m_tilesMap[iTile]--;
|
||||
m_ntiles--;
|
||||
m_nbTiles--;
|
||||
}
|
||||
|
||||
|
||||
|
@ -98,13 +98,13 @@ void Bag::replaceTile(const Tile &iTile)
|
|||
"Cannot replace tile: " + lfw(iTile.getDisplayStr()));
|
||||
|
||||
m_tilesMap[iTile]++;
|
||||
m_ntiles++;
|
||||
m_nbTiles++;
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
m_tilesMap = iOther.m_tilesMap;
|
||||
m_ntiles = iOther.m_ntiles;
|
||||
m_nbTiles = iOther.m_nbTiles;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
* Warning: b.getNbVowels() + b.getNbConsonants() != b.getNbTiles(),
|
||||
* 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 getNbConsonants() const;
|
||||
|
||||
|
@ -91,7 +91,7 @@ private:
|
|||
map<Tile, int> m_tilesMap;
|
||||
|
||||
/// Total number of tiles in the bag
|
||||
int m_ntiles;
|
||||
int m_nbTiles;
|
||||
|
||||
/// Helper method, used by the various selectRandom*() methods
|
||||
Tile selectRandomTile(unsigned int total,
|
||||
|
|
Loading…
Reference in a new issue