meilleurs coms ig
This commit is contained in:
@@ -20,7 +20,6 @@ Board::Board(int width, int height) :
|
||||
}
|
||||
|
||||
void Board::changeBlock(const Position& position, Block block) {
|
||||
// if the block is out of bounds we discard it
|
||||
if (position.x < 0 || position.x >= this->width || position.y < 0) return;
|
||||
|
||||
// resize the grid if needed
|
||||
@@ -62,7 +61,7 @@ int Board::clearRows() {
|
||||
|
||||
if (lineIsFull) {
|
||||
this->grid.erase(this->grid.begin() + j);
|
||||
if(this->grid.size() < height) {
|
||||
if(this->grid.size() < this->height) {
|
||||
this->grid.push_back(this->emptyRow);
|
||||
}
|
||||
clearedLines++;
|
||||
@@ -74,7 +73,7 @@ int Board::clearRows() {
|
||||
|
||||
void Board::clearBoard() {
|
||||
this->grid.clear();
|
||||
for (int j = 0; j < height; j++) {
|
||||
for (int j = 0; j < this->height; j++) {
|
||||
this->grid.push_back(this->emptyRow);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user