Ensured exceptions are unstickied. (Fix for bug #16536.)

One of the changes only is needed, but all of them have been added to
be on the safe side.
This commit is contained in:
Guillaume Melquiond 2010-08-27 18:33:39 +00:00
parent 7a27f99716
commit a18869dce0
3 changed files with 7 additions and 2 deletions

View file

@ -143,6 +143,7 @@ static LEVEL_RESULT playsingle_scenario(const config& game_config,
playcontroller.linger();
} catch(end_level_exception& e) {
if (e.result == QUIT) {
game::exception::sticky = NULL;
return QUIT;
}
}
@ -189,6 +190,7 @@ static LEVEL_RESULT playmp_scenario(const config& game_config,
playcontroller.linger();
} catch(end_level_exception& e) {
if (e.result == QUIT) {
game::exception::sticky = NULL;
return QUIT;
}
}

View file

@ -406,6 +406,7 @@ LEVEL_RESULT playsingle_controller::play_scenario(
}
throw lge;
} catch (end_level_exception &end_level_exn) {
game::exception::sticky = NULL;
ai_testing::log_game_end();
LEVEL_RESULT end_level_result = end_level_exn.result;
if (!end_level.custom_endlevel_music.empty()) {

View file

@ -50,6 +50,7 @@ LEVEL_RESULT play_replay_level(const config& game_config,
}
}
catch(end_level_exception&){
game::exception::sticky = NULL;
DBG_NG << "play_replay_level: end_level_exception\n";
}
@ -270,7 +271,7 @@ void replay_controller::play_replay(){
is_playing_ = false;
}
catch(end_level_exception& e){
if (e.result == QUIT) { throw e; }
if (e.result == QUIT) throw;
}
}
@ -337,7 +338,8 @@ void replay_controller::play_side(const unsigned int /*team_index*/, bool){
}
catch(end_level_exception& e){
//VICTORY/DEFEAT end_level_exception shall not return to title screen
if ((e.result != VICTORY) && (e.result != DEFEAT)) { throw e; }
if (e.result == VICTORY || e.result == DEFEAT) return;
throw;
}
}