diff --git a/ThinkPink/mainwindow.cpp b/ThinkPink/mainwindow.cpp index d23f581..4c19b3e 100644 --- a/ThinkPink/mainwindow.cpp +++ b/ThinkPink/mainwindow.cpp @@ -14,7 +14,7 @@ void MainWindow::clearConnected(std::set> *connected) { qApp->processEvents(); usleep(550000); for (auto i = connected->begin(); i != connected->end(); i++) { - buttonGrid[(*i)[0]][(*i)[1]]->setEnabled(false); + //buttonGrid[(*i)[0]][(*i)[1]]->setEnabled(false); game->deleteCell((*i)[0], (*i)[1]); } refreshButtonGrid(); @@ -38,9 +38,9 @@ void MainWindow::refreshButtonGrid() { void MainWindow::bubbleUp(int row, int column) { if (row > 0) { - QPushButton *tbutton = std::move(buttonGrid[row][column]); + /*QPushButton *tbutton = std::move(buttonGrid[row][column]); buttonGrid[row][column] = std::move(buttonGrid[row-1][column]); - buttonGrid[row-1][column] = std::move(tbutton); + buttonGrid[row-1][column] = std::move(tbutton);*/ QString tcolor = game->getCell(row, column); game->setCell(row, column, game->getCell(row-1, column)); @@ -48,6 +48,7 @@ void MainWindow::bubbleUp(int row, int column) { bubbleUp(row-1, column); } } + void MainWindow::bubbleBoxes(std::set> *connected) { usleep(400000); for (auto i = connected->begin(); i != connected->end(); i++) { @@ -58,11 +59,13 @@ void MainWindow::bubbleBoxes(std::set> *connected) { // slots void MainWindow::buttonPressed(int row, int column) { - std::set> connected; - game->getConnected(&connected, game->getCell(row, column), row, column); - if ( connected.size() > 1) { - clearConnected(&connected); - bubbleBoxes(&connected); + if(game->getCell(row, column) != "") { + std::set> connected; + game->getConnected(&connected, game->getCell(row, column), row, column); + if ( connected.size() > 1) { + clearConnected(&connected); + bubbleBoxes(&connected); + } } else ui->statusBar->showMessage("Only friends get Stars!", 2000); } @@ -139,6 +142,7 @@ MainWindow::MainWindow(QWidget *parent) this->setPalette(pal); ui->menuPlay->setPalette(pal); ui->menuBar->setStyleSheet("QMenuBar::item {color: #a4133c}"); + ui->statusBar->setStyleSheet("color: #a4133c"); refreshSizes(); game = new SameGame(rows, columns); initialiseGame();