meilleurs coms ig

This commit is contained in:
2025-03-03 22:34:46 +01:00
parent d029589c21
commit 2fbe4a6052
13 changed files with 56 additions and 78 deletions

View File

@@ -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);
}
}