From 05605a63ae158af9607f0ab71a2c9798ead12604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Teuli=C3=A8re?= Date: Wed, 26 Dec 2012 17:03:43 +0100 Subject: [PATCH] Coord: remove useless code --- game/coord.cpp | 31 ++++++------------------------- game/coord.h | 7 +------ 2 files changed, 7 insertions(+), 31 deletions(-) diff --git a/game/coord.cpp b/game/coord.cpp index f8706a9..d5c1dd1 100644 --- a/game/coord.cpp +++ b/game/coord.cpp @@ -49,14 +49,6 @@ bool Coord::isValid() const m_col >= BOARD_MIN && m_col <= BOARD_MAX); } -/* -void Coord::operator=(const Coord &iOther) -{ - m_dir = iOther.m_dir; - m_row = iOther.m_row; - m_col = iOther.m_col; -} -*/ bool Coord::operator==(const Coord &iOther) const { @@ -67,6 +59,7 @@ bool Coord::operator==(const Coord &iOther) const && m_dir == iOther.m_dir; } + void Coord::swap() { int tmp = m_col; @@ -105,7 +98,7 @@ void Coord::setFromString(const wstring &iWStr) setCol(-1); } -wstring Coord::toString(coord_mode_t mode) const +wstring Coord::toString() const { ASSERT(isValid(), "Invalid coordinates"); @@ -116,22 +109,10 @@ wstring Coord::toString(coord_mode_t mode) const _swprintf(scol, 3, L"%d", m_col); _swprintf(srow, 3, L"%c", m_row + 'A' - 1); - switch (mode) - { - case COORD_MODE_COMPACT: - if (getDir() == HORIZONTAL) - _swprintf(res, 7, L"%ls%ls", srow, scol); - else - _swprintf(res, 7, L"%ls%ls", scol, srow); - break; - case COORD_MODE_LONG: - if (getDir() == HORIZONTAL) - _swprintf(res, 7, L"%2ls %2ls", srow, scol); - else - _swprintf(res, 7, L"%2ls %2ls", scol, srow); - break; - } - + if (getDir() == HORIZONTAL) + _swprintf(res, 7, L"%ls%ls", srow, scol); + else + _swprintf(res, 7, L"%ls%ls", scol, srow); return res; } diff --git a/game/coord.h b/game/coord.h index b683396..e7280c3 100644 --- a/game/coord.h +++ b/game/coord.h @@ -59,13 +59,8 @@ public: void swap(); - enum coord_mode_t - { - COORD_MODE_COMPACT, - COORD_MODE_LONG - }; void setFromString(const wstring &iStr); - wstring toString(coord_mode_t mode = COORD_MODE_COMPACT) const; + wstring toString() const; private: Direction m_dir;