diff --git a/src/gui/welcomescreen.cpp b/src/gui/welcomescreen.cpp --- a/src/gui/welcomescreen.cpp +++ b/src/gui/welcomescreen.cpp @@ -143,29 +143,49 @@ void WelcomeScreen::startEmptyGame() { GameVariant* variant = selectedVariant(); - if(!variant) return; + if(!variant) { + KMessageBox::sorry(this, i18n("Please select a puzzle variant."), i18n("Unable to start puzzle")); + return; + } Game game = variant->startEmpty(); - if (! game.isValid()) return; + if (! game.isValid()) { + KMessageBox::sorry(this, i18n("Unable to create an empty puzzle of the chosen variant; please try another."), i18n("Unable to start puzzle")); + return; + } emit newGameStarted(game, variant); } void WelcomeScreen::playVariant() { return; // Disable old game-creation code. GameVariant* variant = selectedVariant(); - if(!variant) return; + if(!variant) { + KMessageBox::sorry(this, i18n("Please select a puzzle variant."), i18n("Unable to start puzzle")); + return; + } Game game = variant->createGame(difficulty(), 0); + if(!game.isValid()) { + KMessageBox::sorry(this, i18n("Unable to start a puzzle of the chosen variant; please try another."), i18n("Unable to start puzzle")); + return; + } emit newGameStarted(game, variant); } void WelcomeScreen::generatePuzzle() { GameVariant* variant = selectedVariant(); - if(!variant) return; + if(!variant) { + KMessageBox::sorry(this, i18n("Please select a puzzle variant."), i18n("Unable to start puzzle")); + return; + } Game game = variant->createGame(difficulty(), symmetry()); + if(!game.isValid()) { + KMessageBox::sorry(this, i18n("Unable to generate a puzzle of the chosen variant; please try another."), i18n("Unable to start puzzle")); + return; + } // Save the selected puzzle configuration. QModelIndex index = gameListWidget->currentIndex();