mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:23:52 +00:00
Improve exception handling when starting a new game from the main menu
This commit is contained in:
parent
d7a4a9fd66
commit
07937c741a
1 changed files with 20 additions and 3 deletions
|
@ -139,11 +139,28 @@ void MWState::StateManager::newGame (bool bypass)
|
||||||
if (!bypass)
|
if (!bypass)
|
||||||
MWBase::Environment::get().getWindowManager()->setNewGame (true);
|
MWBase::Environment::get().getWindowManager()->setNewGame (true);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
MWBase::Environment::get().getScriptManager()->getGlobalScripts().addStartup();
|
MWBase::Environment::get().getScriptManager()->getGlobalScripts().addStartup();
|
||||||
|
|
||||||
MWBase::Environment::get().getWorld()->startNewGame (bypass);
|
MWBase::Environment::get().getWorld()->startNewGame (bypass);
|
||||||
|
|
||||||
mState = State_Running;
|
mState = State_Running;
|
||||||
|
}
|
||||||
|
catch (std::exception& e)
|
||||||
|
{
|
||||||
|
std::stringstream error;
|
||||||
|
error << "Failed to start new game: " << e.what();
|
||||||
|
|
||||||
|
std::cerr << error.str() << std::endl;
|
||||||
|
cleanup (true);
|
||||||
|
|
||||||
|
MWBase::Environment::get().getWindowManager()->pushGuiMode (MWGui::GM_MainMenu);
|
||||||
|
|
||||||
|
std::vector<std::string> buttons;
|
||||||
|
buttons.push_back("#{sOk}");
|
||||||
|
MWBase::Environment::get().getWindowManager()->interactiveMessageBox(error.str(), buttons);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWState::StateManager::endGame()
|
void MWState::StateManager::endGame()
|
||||||
|
|
Loading…
Reference in a new issue