Skip to content

Commit

Permalink
Game Launcher: moved outtro handling to campaign_controller
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed Jan 6, 2021
1 parent 321b496 commit 39ca794
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 9 additions & 0 deletions src/game_initialization/playcampaign.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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"),
Expand Down
8 changes: 0 additions & 8 deletions src/game_launcher.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 39ca794

Please sign in to comment.