summaryrefslogtreecommitdiff
path: root/src/Model
diff options
context:
space:
mode:
authormanzerbredes <loic.guegan_secondary@yahoo.fr>2015-05-01 13:18:26 +0200
committermanzerbredes <loic.guegan_secondary@yahoo.fr>2015-05-01 13:18:26 +0200
commit048f1e17b752d2af53db82c1861002283fc300fa (patch)
treeaf7e01538efa1304e53ed89786ff7afeadc3a325 /src/Model
parent672358a947ff4bff7e0b4e0afaa90c30480ce65b (diff)
Add some newers things :
-Change helper ModelConstants to Keyboard -Now helpers is in folder Helpers -Change direction name to use CamelCase
Diffstat (limited to 'src/Model')
-rw-r--r--src/Model/Grid.cpp82
-rw-r--r--src/Model/Grid.hpp8
-rw-r--r--src/Model/ModelConstants.hpp12
3 files changed, 1 insertions, 101 deletions
diff --git a/src/Model/Grid.cpp b/src/Model/Grid.cpp
index 75c0209..cc9cdb1 100644
--- a/src/Model/Grid.cpp
+++ b/src/Model/Grid.cpp
@@ -82,86 +82,4 @@ void Grid::setCell(int i, int j, Cell *cell)
}
-void Grid::move(Direction direction)
-{
- switch (direction)
- {
- case UP:
-
- break;
-
- case DOWN:
- break;
-
- case LEFT:
- break;
-
- case RIGHT:
- break;
-
- default:
- break;
- }
-}
-
-void Grid::moveDown()
-{/*
- for (int i = 0 ; i < m_size; i++)
- {
- // If the column is full, check the next column
- bool columnIsFull = true;
-
- for (int j = 0; j < m_size; j++)
- {
- if (m_table[j][i]->isEmpty())
- {
- columnIsFull = false;
- break;
- }
- }
- while (!columnIsFull)
- {
- // Calculate the first line to merge
- int firstLine = m_size - 1;
- while (m_table[firstLine][i]->isEmpty() && firstLine > 0)
- firstLine--;
- if (firstLine == 0)
- break;
-
- // Calculate the second line to merge
- int secondLine = firstLine - 1;
- while (m_table[secondLine][i]->isEmpty() && secondLine > 0)
- secondLine--;
-
- // If there is only one element, pull it down
- if (m_table[secondLine][i]->isEmpty() && firstLine != m_size - 1)
- {
- Cell * originalCell = m_table[firstLine][i];
- Cell * finalCell = m_table[m_size-1][i];
-
- m_table[firstLine][i] = finalCell;
- m_table[m_size-1][i] = originalCell;
-
- break;
- }
-
- // If there is only one element which is at the full bottom, break the loop
- if (m_table[secondLine][i]->isEmpty())
- break;
-
- // If there are two "good" elements, begin the merge process
- Cell * cell1 = m_table[firstLine][i];
- Cell * cell2 = m_table[secondLine][i];
-
- Cell * mergedCell = NULL;
-
- // If the two cells are the same, merge them
- if (cell1->equals(cell2))
- {
- int value = std::stoi(cell1->getValue());
- mergedCell = new Cell(std::to_string(value));
- }
- }
- }*/
-}
diff --git a/src/Model/Grid.hpp b/src/Model/Grid.hpp
index 2a28559..c431cb3 100644
--- a/src/Model/Grid.hpp
+++ b/src/Model/Grid.hpp
@@ -10,7 +10,7 @@
#include <iostream>
#include <vector>
-#include "ModelConstants.hpp"
+//#include "ModelConstants.hpp"
#include "Cell.hpp"
class Grid
@@ -19,11 +19,6 @@ class Grid
int m_size;
std::vector<std::vector<Cell*> > m_table;
- void moveUp();
- void moveDown();
- void moveLeft();
- void moveRight();
-
public:
Grid(int size);
~Grid();
@@ -33,7 +28,6 @@ class Grid
bool gridIsFull();
void setCell(int i, int j, Cell * cell);
- void move(Direction direction);
};
diff --git a/src/Model/ModelConstants.hpp b/src/Model/ModelConstants.hpp
deleted file mode 100644
index 5cbc21b..0000000
--- a/src/Model/ModelConstants.hpp
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef DEF_MODELCONSTANTS
-#define DEF_MODELCONSTANTS
-
-/* ModelConstants.hpp
- * Constains constants and enums used in the whole model
- * Creators : krilius, manzerbredes
- * Date : 29/04/2015 */
-
-enum Direction { UP, DOWN, LEFT, RIGHT };
-typedef enum Direction Direction;
-
-#endif \ No newline at end of file