Score gets updated correctly now

This means that the Score functionality is entirely complete now!
main
Isabell Pflug 1 year ago
parent e5ad6e110f
commit 8e4d58372f

@ -8,11 +8,14 @@ void MainWindow::buttonPressed(int row, int column) {
QString text = "\u2605";
std::set<std::vector<int>> 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);
}

Loading…
Cancel
Save