Commit f88dd6ae authored by Frederik Schwarzer's avatar Frederik Schwarzer

Refactor members.

parent 194fc542
......@@ -22,10 +22,8 @@
namespace KShisen
{
Move::Move(TilePos const & tilePos1, TilePos const & tilePos2, int tile1, int tile2)
: m_x1(tilePos1.x())
, m_y1(tilePos1.y())
, m_x2(tilePos2.x())
, m_y2(tilePos2.y())
: m_tilePos1(tilePos1)
, m_tilePos2(tilePos2)
, m_tile1(tile1)
, m_tile2(tile2)
, m_hasSlide(false)
......@@ -37,10 +35,8 @@ Move::Move(TilePos const & tilePos1, TilePos const & tilePos2, int tile1, int ti
}
Move::Move(TilePos const & tilePos1, TilePos const & tilePos2, int tile1, int tile2, int slideX1, int slideY1, int slideX2, int slideY2)
: m_x1(tilePos1.x())
, m_y1(tilePos1.y())
, m_x2(tilePos2.x())
, m_y2(tilePos2.y())
: m_tilePos1(tilePos1)
, m_tilePos2(tilePos2)
, m_tile1(tile1)
, m_tile2(tile2)
, m_hasSlide(true)
......@@ -53,22 +49,22 @@ Move::Move(TilePos const & tilePos1, TilePos const & tilePos2, int tile1, int ti
int Move::x1() const
{
return m_x1;
return m_tilePos1.x();
}
int Move::y1() const
{
return m_y1;
return m_tilePos1.y();
}
int Move::x2() const
{
return m_x2;
return m_tilePos2.x();
}
int Move::y2() const
{
return m_y2;
return m_tilePos2.y();
}
int Move::tile1() const
......@@ -108,8 +104,7 @@ int Move::slideY2() const
void Move::swapTiles()
{
std::swap(m_x1, m_x2);
std::swap(m_y1, m_y2);
std::swap(m_tilePos1, m_tilePos2);
std::swap(m_tile1, m_tile2);
}
}
......
......@@ -54,7 +54,8 @@ public:
void swapTiles();
private:
int m_x1, m_y1, m_x2, m_y2; ///< coordinates of the two tiles that matched
TilePos m_tilePos1; ///< coordinates of the first tile that matched
TilePos m_tilePos2; ///< coordinates of the second tile that matched
int m_tile1; ///< type of tile at first set of coordinates
int m_tile2; ///< type of tile at second set of coordinates
bool m_hasSlide; ///< if we performed a slide during the move
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment