Skip to content

Commit

Permalink
catch exceptions from multiplayer_create destructor
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeck88 committed Jun 8, 2014
1 parent 55d5a11 commit 4b2ea78
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/multiplayer_create.cpp
Expand Up @@ -192,19 +192,21 @@ create::create(game_display& disp, const config& cfg, game_state& state,

create::~create()
{
// Only save the settings if the dialog was 'accepted'
if(get_result() != CREATE) {
DBG_MP << "destructing multiplayer create dialog - aborted game creation" << std::endl;
return;
}
DBG_MP << "destructing multiplayer create dialog - a game will be created" << std::endl;

// Save values for next game
DBG_MP << "storing parameter values in preferences" << std::endl;
preferences::set_era(engine_.current_extra(create_engine::ERA).id);
preferences::set_level(engine_.current_level().id());
preferences::set_level_type(engine_.current_level_type());
preferences::set_modifications(engine_.active_mods());
try {
// Only save the settings if the dialog was 'accepted'
if(get_result() != CREATE) {
DBG_MP << "destructing multiplayer create dialog - aborted game creation" << std::endl;
return;
}
DBG_MP << "destructing multiplayer create dialog - a game will be created" << std::endl;

// Save values for next game
DBG_MP << "storing parameter values in preferences" << std::endl;
preferences::set_era(engine_.current_extra(create_engine::ERA).id);
preferences::set_level(engine_.current_level().id());
preferences::set_level_type(engine_.current_level_type());
preferences::set_modifications(engine_.active_mods());
} catch (...) {}
}

const mp_game_settings& create::get_parameters()
Expand Down

0 comments on commit 4b2ea78

Please sign in to comment.