mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-01-18 10:26:15 +01:00
Warn on game creation before showing the new game dialog, not after
This commit is contained in:
parent
4b4b715a41
commit
6c16f203a5
1 changed files with 6 additions and 9 deletions
|
@ -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"));
|
||||||
|
|
Loading…
Reference in a new issue