BoardLayout: make a method public, and use it to simplify an assertion

This commit is contained in:
Olivier Teulière 2013-01-18 12:13:20 +01:00
parent 7923ed2c2a
commit 80fa47d71b
2 changed files with 3 additions and 5 deletions

View file

@ -94,9 +94,7 @@ bool Board::isJoker(int iRow, int iCol) const
bool Board::isVacant(int iRow, int iCol) const
{
ASSERT(iRow >= 1 && (unsigned)iRow <= m_layout.getRowCount() &&
iCol >= 1 && (unsigned)iCol <= m_layout.getColCount(),
"Invalid coordinates");
ASSERT(m_layout.isValidCoord(iRow, iCol), "Invalid coordinates");
return m_tilesRow[iRow][iCol].isEmpty();
}

View file

@ -34,6 +34,8 @@ class BoardLayout
public:
BoardLayout();
bool isValidCoord(unsigned iRow, unsigned iCol) const;
unsigned getRowCount() const;
unsigned getColCount() const;
int getWordMultiplier(unsigned iRow, unsigned iCol) const;
@ -48,8 +50,6 @@ private:
Matrix<int> m_wordMultipliers;
Matrix<int> m_tileMultipliers;
bool isValidCoord(unsigned iRow, unsigned iCol) const;
void setDefaultLayout();
};