mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-07 05:06:32 +00:00
Fixes bug #8889 (recall list woes on loading)
and possibly fixes bug #8886 (empty recall list)
This commit is contained in:
parent
7f5611f4d2
commit
3106bcac0a
@ -42,7 +42,7 @@ std::string get_unique_saveid(const config& cfg, std::set<std::string>& seen_sav
|
||||
return save_id;
|
||||
}
|
||||
|
||||
void get_player_info(const config& cfg, game_state& gamestate, std::string save_id, std::vector<team>& teams, const config& level, const game_data& gameinfo, gamemap& map, unit_map& units, gamestatus& game_status){
|
||||
void get_player_info(const config& cfg, game_state& gamestate, std::string save_id, std::vector<team>& teams, const config& level, const game_data& gameinfo, gamemap& map, unit_map& units, gamestatus& game_status, bool snapshot){
|
||||
player_info *player = NULL;
|
||||
|
||||
if(cfg["controller"] == "human" ||
|
||||
@ -143,6 +143,14 @@ void get_player_info(const config& cfg, game_state& gamestate, std::string save_
|
||||
|
||||
//if there are additional starting units on this side
|
||||
const config::child_list& starting_units = cfg.get_children("unit");
|
||||
//available_units has been filled by loading the [player]-section already. However, we need
|
||||
//to get the information from the snapshot so we start from scratch here. This is rather a
|
||||
//quick hack, originating from keeping changes as minimal as possible for 1.2. Moving [player]
|
||||
//into [replay_start] should be the correct way to go.
|
||||
if (player && snapshot){
|
||||
player->available_units.clear();
|
||||
}
|
||||
//backwards compatibility code for 1.2/1.2.1
|
||||
if ( (starting_units.begin() != starting_units.end()) && player && (gamestate.version < "1.2.2") ){
|
||||
player->available_units.clear();
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ class unit_map;
|
||||
|
||||
std::string get_unique_saveid(const config& cfg, std::set<std::string>& seen_save_ids);
|
||||
int get_first_human_team(const config::child_list::const_iterator& cfg, const config::child_list& unit_cfg);
|
||||
void get_player_info(const config& cfg, game_state& gamestate, std::string save_id, std::vector<team>& teams, const config& level, const game_data& gameinfo, gamemap& map, unit_map& units, gamestatus& game_status);
|
||||
void get_player_info(const config& cfg, game_state& gamestate, std::string save_id, std::vector<team>& teams, const config& level, const game_data& gameinfo, gamemap& map, unit_map& units, gamestatus& game_status, bool snapshot);
|
||||
const config* get_theme(const config& game_config, std::string theme_name);
|
||||
|
||||
#endif
|
||||
|
@ -69,6 +69,7 @@ void play_controller::init(CVideo& video){
|
||||
recorder.set_skip(false);
|
||||
|
||||
const config::child_list& unit_cfg = level_.get_children("side");
|
||||
bool snapshot = level_["snapshot"] == "yes";
|
||||
|
||||
if(level_["modify_placing"] == "true") {
|
||||
LOG_NG << "modifying placing...\n";
|
||||
@ -86,7 +87,7 @@ void play_controller::init(CVideo& video){
|
||||
if (first_human_team_ == -1){
|
||||
first_human_team_ = get_first_human_team(ui, unit_cfg);
|
||||
}
|
||||
get_player_info(**ui, gamestate_, save_id, teams_, level_, gameinfo_, map_, units_, status_);
|
||||
get_player_info(**ui, gamestate_, save_id, teams_, level_, gameinfo_, map_, units_, status_, snapshot);
|
||||
}
|
||||
|
||||
preferences::encounter_recruitable_units(teams_);
|
||||
|
Loading…
x
Reference in New Issue
Block a user