Improve exception handling when starting a new game from the main menu

c++11
scrawl 10 years ago
parent d7a4a9fd66
commit 07937c741a

@ -139,12 +139,29 @@ void MWState::StateManager::newGame (bool bypass)
if (!bypass)
MWBase::Environment::get().getWindowManager()->setNewGame (true);
try
{
MWBase::Environment::get().getScriptManager()->getGlobalScripts().addStartup();
MWBase::Environment::get().getWorld()->startNewGame (bypass);
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()
{

Loading…
Cancel
Save