|
|
|
@ -36,12 +36,19 @@ void MainWindow::refreshButtonGrid() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::bubbleRight(int column) {
|
|
|
|
|
if (column < columns-1) {
|
|
|
|
|
for (int row = 0; row < rows; row++) {
|
|
|
|
|
QString tcolor = game->getCell(row, column);
|
|
|
|
|
game->setCell(row, column, game->getCell(row, column+1));
|
|
|
|
|
game->setCell(row, column+1, tcolor);
|
|
|
|
|
}
|
|
|
|
|
bubbleRight(column+1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::bubbleUp(int row, int column) {
|
|
|
|
|
if (row > 0) {
|
|
|
|
|
/*QPushButton *tbutton = std::move(buttonGrid[row][column]);
|
|
|
|
|
buttonGrid[row][column] = std::move(buttonGrid[row-1][column]);
|
|
|
|
|
buttonGrid[row-1][column] = std::move(tbutton);*/
|
|
|
|
|
|
|
|
|
|
QString tcolor = game->getCell(row, column);
|
|
|
|
|
game->setCell(row, column, game->getCell(row-1, column));
|
|
|
|
|
game->setCell(row-1, column, tcolor);
|
|
|
|
@ -54,6 +61,16 @@ void MainWindow::bubbleBoxes(std::set<std::vector<int>> *connected) {
|
|
|
|
|
for (auto i = connected->begin(); i != connected->end(); i++) {
|
|
|
|
|
bubbleUp((*i)[0], (*i)[1]);
|
|
|
|
|
}
|
|
|
|
|
bool isEmpty;
|
|
|
|
|
for (int j = 0; j < columns; j++) {
|
|
|
|
|
isEmpty = true;
|
|
|
|
|
for (int i = 0; i < rows; i++) {
|
|
|
|
|
if (game->getCell(i, j) != "")
|
|
|
|
|
isEmpty = false;
|
|
|
|
|
}
|
|
|
|
|
if (isEmpty)
|
|
|
|
|
bubbleRight(j);
|
|
|
|
|
}
|
|
|
|
|
refreshButtonGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|