|
|
|
@ -44,6 +44,22 @@ void MainWindow::checkColumn(int column) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool MainWindow::checkLeftoverMoves() {
|
|
|
|
|
for(int row = 0; row < rows; row++) {
|
|
|
|
|
for(int column = 0; column < columns; column++)
|
|
|
|
|
{
|
|
|
|
|
if (game->getCell(row,column) != "none") {
|
|
|
|
|
std::set<std::vector<int>> tset;
|
|
|
|
|
game->getConnected(&tset, game->getCell(row,column), row, column);
|
|
|
|
|
if (tset.size() > 1) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::bubbleRight(int column) {
|
|
|
|
|
if (column < columns-1) {
|
|
|
|
|
for (int row = 0; row < rows; row++) {
|
|
|
|
@ -92,9 +108,13 @@ void MainWindow::buttonPressed(int row, int column) {
|
|
|
|
|
ui->statusBar->showMessage("Only friends get Stars!", 2000);
|
|
|
|
|
}
|
|
|
|
|
MainWindow::setEnabled(true);
|
|
|
|
|
if (!checkLeftoverMoves()) {
|
|
|
|
|
ui->statusBar->showMessage("Game over.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::newGame() {
|
|
|
|
|
ui->statusBar->clearMessage();
|
|
|
|
|
MainWindow::setEnabled(false);
|
|
|
|
|
QMessageBox newGameDialog;
|
|
|
|
|
newGameDialog.setText("Do you really want to start a new game?");
|
|
|
|
@ -105,6 +125,9 @@ void MainWindow::newGame() {
|
|
|
|
|
ui->lcdScore->display(0);
|
|
|
|
|
}
|
|
|
|
|
MainWindow::setEnabled(true);
|
|
|
|
|
if (!checkLeftoverMoves()) {
|
|
|
|
|
ui->statusBar->showMessage("Game over.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// initialisation functions
|
|
|
|
|