From 80fa47d71b30042f870b0dd9bbce8750115dc4ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Teuli=C3=A8re?= Date: Fri, 18 Jan 2013 12:13:20 +0100 Subject: [PATCH] BoardLayout: make a method public, and use it to simplify an assertion --- game/board.cpp | 4 +--- game/board_layout.h | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/game/board.cpp b/game/board.cpp index 5bde1ad..cd7286e 100644 --- a/game/board.cpp +++ b/game/board.cpp @@ -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(); } diff --git a/game/board_layout.h b/game/board_layout.h index 7632e4f..fa52cc3 100644 --- a/game/board_layout.h +++ b/game/board_layout.h @@ -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 m_wordMultipliers; Matrix m_tileMultipliers; - bool isValidCoord(unsigned iRow, unsigned iCol) const; - void setDefaultLayout(); };