Remove game_config_manager_state class.

The class is not useful due to a bug with dangling pointers of game
config.
This commit is contained in:
Andrius Silinskas 2013-06-19 09:44:43 +01:00
parent 7df2142fd8
commit d8190d20a7
2 changed files with 0 additions and 52 deletions

View file

@ -89,8 +89,6 @@ bool game_config_manager::init_game_config(FORCE_RELOAD_CONFIG force_reload)
void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload)
{
game_config_manager_state manager_state(&game_config_, &old_defines_map_);
// Make sure that 'debug mode' symbol is set
// if command line parameter is selected
// also if we're in multiplayer and actual debug mode is disabled.
@ -101,7 +99,6 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload)
if(!game_config_.empty() &&
(force_reload == NO_FORCE_RELOAD)
&& old_defines_map_ == cache_.get_preproc_map()) {
manager_state.set_status_success();
return;
}
@ -157,8 +154,6 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload)
old_defines_map_ = cache_.get_preproc_map();
manager_state.set_status_success();
// Set new binary paths.
paths_manager_.set_paths(game_config());
}
@ -342,26 +337,3 @@ void game_config_manager::load_game_config_for_game(
}
}
game_config_manager_state::game_config_manager_state(config* game_config,
preproc_map* old_defines_map) :
status_success_(false),
game_config_original_(*game_config),
game_config_(game_config),
old_defines_map_original_(*old_defines_map),
old_defines_map_(old_defines_map)
{
}
game_config_manager_state::~game_config_manager_state()
{
// Revert back to original state.
if(!status_success_) {
*game_config_ = game_config_original_;
*old_defines_map_ = old_defines_map_original_;
}
}
void game_config_manager_state::set_status_success()
{
status_success_ = true;
}

View file

@ -64,28 +64,4 @@ private:
game_config::config_cache& cache_;
};
// Helper class to save game_config_manager's
// state in case of failed load_game_config().
class game_config_manager_state
{
public:
game_config_manager_state(config* game_config,
preproc_map* old_defines_map);
~game_config_manager_state();
void set_status_success();
private:
game_config_manager_state(const game_config_manager& config_manager);
void operator=(const game_config_manager&);
bool status_success_;
const config game_config_original_;
config* const game_config_;
const preproc_map old_defines_map_original_;
preproc_map* const old_defines_map_;
};
#endif