From e72ce203657c6fdcbb3dab840672c6dba2df7894 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Mon, 4 May 2015 17:07:03 +0200 Subject: [PATCH] Clean some things --- src/Model/Game.cpp | 18 ++---------------- src/Model/Game.hpp | 7 ++----- src/Model/Stats.cpp | 9 +++++++-- src/Model/Stats.hpp | 9 ++++----- 4 files changed, 15 insertions(+), 28 deletions(-) diff --git a/src/Model/Game.cpp b/src/Model/Game.cpp index 5781f54..58a87fb 100644 --- a/src/Model/Game.cpp +++ b/src/Model/Game.cpp @@ -49,11 +49,6 @@ void Game::coutGrid(){ std::cout << this->description(); } -//Return true if the game is lost. False else. -//bool Game::isOver(){ - //return m_grid.isOver(); -//} - //Pop a random number on the grid void Game::popRandomNumber(){ std::tuple coord(Grid::getRandomEmptyCellCoord()); @@ -69,22 +64,13 @@ void Game::popRandomNumber(){ number=2; } - Grid::setCell(coord, number); } + + //==================== Getters and Setter ==================== //Retrieve the Score Stats Game::getStats(){ return m_stats; } - - -//std::vector > Game::getGrid(){ - //return m_grid.getGrid(); -//} - - -//int Game::maxStrLenInGrid(){ - //return m_grid.maxStrLenInGrid(); -//} diff --git a/src/Model/Game.hpp b/src/Model/Game.hpp index e468176..684c01e 100644 --- a/src/Model/Game.hpp +++ b/src/Model/Game.hpp @@ -9,16 +9,16 @@ #include #include +#include + #include "../Helpers/Keyboard.hpp" #include "Grid.hpp" #include "Stats.hpp" -#include class Game : public Grid { private: //Members - //Grid m_grid; Stats m_stats; public: //Constructor and Destructor @@ -29,12 +29,9 @@ class Game : public Grid bool swipe(kbdh::Direction direction); void coutGrid(); void popRandomNumber(); - //bool isOver(); //Getters and Setters Stats getStats(); - //int maxStrLenInGrid(); - //std::vector > getGrid(); }; #endif diff --git a/src/Model/Stats.cpp b/src/Model/Stats.cpp index 8bada78..7a473cc 100644 --- a/src/Model/Stats.cpp +++ b/src/Model/Stats.cpp @@ -1,6 +1,10 @@ #include "Stats.hpp" + +//==================== Constructor and destructor ==================== + +//Constructor Stats::Stats() : m_score(0), m_nbMove(0) @@ -8,11 +12,12 @@ Stats::Stats() : } +//Destructor Stats::~Stats(){ } - +//==================== Helpers ==================== void Stats::incScore(int value){ m_score+=value; } @@ -20,7 +25,7 @@ void Stats::incnbMove(){ m_nbMove++; } - +//==================== Getters ==================== int Stats::getScore(){ return m_score; } diff --git a/src/Model/Stats.hpp b/src/Model/Stats.hpp index 49c7356..d55f83f 100644 --- a/src/Model/Stats.hpp +++ b/src/Model/Stats.hpp @@ -4,22 +4,21 @@ #include - - - class Stats{ private: int m_score; int m_nbMove; public: - + //Constructor and destructor Stats(); ~Stats(); + + //Helpers void incScore(int value); void incnbMove(); - + //Getters int getScore(); int getNbMove();