diff --git a/ThinkPink/mainwindow.cpp b/ThinkPink/mainwindow.cpp index 0a537d7..7e57799 100644 --- a/ThinkPink/mainwindow.cpp +++ b/ThinkPink/mainwindow.cpp @@ -8,11 +8,14 @@ void MainWindow::buttonPressed(int row, int column) { QString text = "\u2605"; std::set> connected; game->getConnected(&connected, game->getCell(row, column), row, column); - if ( connected.size() > 1) + if ( connected.size() > 1) { + int n = connected.size(); + int new_score = ui->lcdScore->intValue() + (n * (n-1)); + ui->lcdScore->display(new_score); for (auto i = connected.begin(); i != connected.end(); i++) { buttonGrid[(*i)[0]][(*i)[1]]->setText(text); } - else + } else ui->statusBar->showMessage("Only friends get Stars!", 2000); }