Skip to content

Commit

Permalink
Reset AI manager singleton pointer when exiting the game (fixes #2523)
Browse files Browse the repository at this point in the history
  • Loading branch information
jyrkive committed Feb 20, 2018
1 parent 1ab31bf commit 5b89aaf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ai/manager.hpp
Expand Up @@ -556,6 +556,7 @@ class manager
ai_composite& get_active_ai_for_side( side_number side );


friend class game_launcher;
};

} //end of namespace ai
2 changes: 2 additions & 0 deletions src/game_launcher.cpp
Expand Up @@ -15,6 +15,7 @@
#include "game_launcher.hpp"
#include "game_errors.hpp"

#include "ai/manager.hpp" // for manager
#include "preferences/credentials.hpp"
#include "commandline_options.hpp" // for commandline_options
#include "config.hpp" // for config, etc
Expand Down Expand Up @@ -959,6 +960,7 @@ void game_launcher::launch_game(RELOAD_GAME_DATA reload)
try {
campaign_controller ccontroller(state_, game_config_manager::get()->game_config(), game_config_manager::get()->terrain_types());
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()) {
Expand Down

0 comments on commit 5b89aaf

Please sign in to comment.