This commit is contained in:
Anja Keicher 2012-09-04 16:24:13 +00:00
parent f7fb36d44b
commit 966fdd8ebc
4 changed files with 18 additions and 7 deletions

View file

@ -601,7 +601,7 @@ bool game_controller::load_game()
load.load_game(game::load_game_exception::game, game::load_game_exception::show_replay, game::load_game_exception::cancel_orders, game::load_game_exception::select_difficulty, game::load_game_exception::difficulty);
cache_.clear_defines();
game_config::scoped_preproc_define dificulty_def(state_.carryover_sides_start["difficulty"]);
game_config::scoped_preproc_define dificulty_def(load.load_config().child("carryover_sides_start")["difficulty"]);
game_config::scoped_preproc_define campaign_define_def(state_.classification().campaign_define, !state_.classification().campaign_define.empty());

View file

@ -352,7 +352,9 @@ void carryover_info::transfer_to(config& level){
wml_menu_items_.to_config(level);
}
level["difficulty"] = difficulty_;
if(level["difficulty"].empty()){
level["difficulty"] = difficulty_;
}
difficulty_ = "";
next_scenario_ = "";
@ -1273,9 +1275,15 @@ void extract_summary_from_config(config& cfg_save, config& cfg_summary)
cfg_summary["label"] = cfg_save["label"];
cfg_summary["parent"] = cfg_save["parent"];
cfg_summary["campaign_type"] = cfg_save["campaign_type"];
cfg_summary["scenario"] = cfg_save["scenario"];
if(cfg_save.has_child("carryover_sides_start")){
cfg_summary["scenario"] = cfg_save.child("carryover_sides_start")["next_scenario"];
cfg_summary["difficulty"] = cfg_save.child("carryover_sides_start")["difficulty"];
} else {
cfg_summary["scenario"] = cfg_save["scenario"];
cfg_summary["difficulty"] = cfg_save["difficulty"];
}
cfg_summary["campaign"] = cfg_save["campaign"];
cfg_summary["difficulty"] = cfg_save["difficulty"];
cfg_summary["version"] = cfg_save["version"];
cfg_summary["corrupt"] = "";

View file

@ -612,6 +612,8 @@ void loadgame::load_game(
std::string error_log;
read_save_file(filename_, load_config_, &error_log);
convert_old_saves(load_config_);
if(!error_log.empty()) {
try {
gui2::show_error_message(gui_.video(),
@ -624,8 +626,9 @@ void loadgame::load_game(
}
}
if (!difficulty_.empty())
load_config_["difficulty"] = difficulty_;
if (!difficulty_.empty()){
load_config_.child("carryover_sides_start")["difficulty"] = difficulty_;
}
gamestate_.classification().campaign_define = load_config_["campaign_define"].str();
gamestate_.classification().campaign_type = load_config_["campaign_type"].str();
@ -683,7 +686,6 @@ void loadgame::check_version_compatibility()
void loadgame::set_gamestate()
{
convert_old_saves(load_config_);
gamestate_ = game_state(load_config_, show_replay_);
// Get the status of the random in the snapshot.

View file

@ -100,6 +100,7 @@ public:
bool show_replay() const { return show_replay_; }
bool cancel_orders() const { return cancel_orders_; }
const std::string filename() const { return filename_; }
const config load_config() const { return load_config_; }
private:
/** Display the load-game dialog. */