Warn on game creation before showing the new game dialog, not after

This commit is contained in:
Olivier Teulière 2012-04-29 02:19:59 +02:00
parent 4b4b715a41
commit 6c16f203a5

View file

@ -727,12 +727,6 @@ void MainWindow::onGameNew()
return; return;
} }
NewGame *newGameDialog = new NewGame(this);
int res = newGameDialog->exec();
if (res == QDialog::Rejected)
return;
if (m_game) if (m_game)
{ {
QString msg = _q("Starting a new game will stop the current one."); QString msg = _q("Starting a new game will stop the current one.");
@ -743,16 +737,19 @@ void MainWindow::onGameNew()
} }
} }
NewGame newGameDialog;
int res = newGameDialog.exec();
if (res == QDialog::Rejected)
return;
// Destroy the game and the associated controls // Destroy the game and the associated controls
destroyCurrentGame(); destroyCurrentGame();
// Create a new game // Create a new game
m_game = newGameDialog->createGame(*m_dic); m_game = newGameDialog.createGame(*m_dic);
if (m_game == NULL) if (m_game == NULL)
return; return;
delete newGameDialog;
m_ui.groupBoxPlayers->show(); m_ui.groupBoxPlayers->show();
displayInfoMsg(_q("Game started")); displayInfoMsg(_q("Game started"));