Game Launcher: moved outtro handling to campaign_controller

This commit is contained in:
Charles Dang 2021-01-07 02:18:42 +11:00
parent 321b496362
commit 39ca794c2a
2 changed files with 9 additions and 8 deletions

View File

@ -31,6 +31,7 @@
#include "generators/map_generator.hpp"
#include "gettext.hpp"
#include "gui/dialogs/message.hpp"
#include "gui/dialogs/outro.hpp"
#include "gui/dialogs/transient_message.hpp"
#include "gui/widgets/retval.hpp"
#include "log.hpp"
@ -335,6 +336,14 @@ LEVEL_RESULT campaign_controller::play_game()
// If there is no next scenario we're done now.
if(state_.get_scenario_id().empty()) {
// Don't show The End for multiplayer scenarios.
if(res == LEVEL_RESULT::VICTORY && !state_.classification().is_normal_mp_game()) {
preferences::add_completed_campaign(
state_.classification().campaign, state_.classification().difficulty);
gui2::dialogs::outro::display(state_.classification());
}
return res;
} else if(res == LEVEL_RESULT::OBSERVER_END && mp_info_ && !mp_info_->is_host) {
const int dlg_res = gui2::show_message(_("Game Over"),

View File

@ -36,7 +36,6 @@
#include "gui/dialogs/multiplayer/mp_connect.hpp"
#include "gui/dialogs/multiplayer/mp_host_game_prompt.hpp" // for host game prompt
#include "gui/dialogs/multiplayer/mp_method_selection.hpp"
#include "gui/dialogs/outro.hpp"
#include "gui/dialogs/title_screen.hpp" // for show_debug_clock_button
#include "gui/dialogs/transient_message.hpp" // for show_transient_message
#include "gui/widgets/retval.hpp" // for window, etc
@ -990,13 +989,6 @@ void game_launcher::launch_game(RELOAD_GAME_DATA reload)
campaign_controller ccontroller(state_);
LEVEL_RESULT result = ccontroller.play_game();
ai::manager::singleton_ = nullptr;
// don't show The End for multiplayer scenario
// change this if MP campaigns are implemented
if(result == LEVEL_RESULT::VICTORY && !state_.classification().is_normal_mp_game()) {
preferences::add_completed_campaign(state_.classification().campaign, state_.classification().difficulty);
gui2::dialogs::outro::display(state_.classification());
}
} catch(savegame::load_game_exception& e) {
load_data_ = std::move(e.data_);
// this will make it so next time through the title screen loop, this game is loaded