Skip to content

Commit

Permalink
Remove game_config_view ctor argument from savegame::loadgame
Browse files Browse the repository at this point in the history
This took the same global game_config_view object in all invocations.
  • Loading branch information
Vultraz committed Jan 5, 2021
1 parent fbe44a4 commit fef1132
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/game_launcher.cpp
Expand Up @@ -667,8 +667,7 @@ bool game_launcher::load_game()

DBG_GENERAL << "Current campaign type: " << state_.classification().campaign_type << std::endl;

savegame::loadgame load(
savegame::save_index_class::default_saves_dir(), game_config_manager::get()->game_config(), state_);
savegame::loadgame load(savegame::save_index_class::default_saves_dir(), state_);
if(load_data_) {
load.data() = std::move(load_data_.value());
clear_loaded_game();
Expand Down
2 changes: 1 addition & 1 deletion src/gui/dialogs/multiplayer/mp_create_game.cpp
Expand Up @@ -781,7 +781,7 @@ void mp_create_game::update_map_settings()

void mp_create_game::load_game_callback()
{
savegame::loadgame load(savegame::save_index_class::default_saves_dir(), cfg_, create_engine_.get_state());
savegame::loadgame load(savegame::save_index_class::default_saves_dir(), create_engine_.get_state());

if(!load.load_multiplayer_game()) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/play_controller.cpp
Expand Up @@ -915,7 +915,7 @@ void play_controller::save_map()

void play_controller::load_game()
{
savegame::loadgame load(savegame::save_index_class::default_saves_dir(), game_config_, saved_game_);
savegame::loadgame load(savegame::save_index_class::default_saves_dir(), saved_game_);
load.load_game_ingame();
}

Expand Down
5 changes: 3 additions & 2 deletions src/savegame.cpp
Expand Up @@ -46,6 +46,7 @@
#include "game_version.hpp"
#include "video.hpp"
#include "game_config_view.hpp"
#include "game_config_manager.hpp"

#include <algorithm>
#include <iomanip>
Expand Down Expand Up @@ -81,8 +82,8 @@ void clean_saves(const std::string& label)
}
}

loadgame::loadgame(const std::shared_ptr<save_index_class>& index, const game_config_view& game_config, saved_game& gamestate)
: game_config_(game_config)
loadgame::loadgame(const std::shared_ptr<save_index_class>& index, saved_game& gamestate)
: game_config_(game_config_manager::get()->game_config())
, gamestate_(gamestate)
, load_data_{index}
{
Expand Down
2 changes: 1 addition & 1 deletion src/savegame.hpp
Expand Up @@ -99,7 +99,7 @@ class load_game_exception
class loadgame
{
public:
loadgame(const std::shared_ptr<save_index_class>& index, const game_config_view& game_config, saved_game& gamestate);
loadgame(const std::shared_ptr<save_index_class>& index, saved_game& gamestate);
virtual ~loadgame() {}

/* In any of the following three function, a bool value of false indicates
Expand Down

0 comments on commit fef1132

Please sign in to comment.