mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-04 10:41:19 +00:00
Fixes bug #10868 (Recall problems in a replay)...
...and introduces another debug method for player_info (which turned out to be helpful in debugging this problem).
This commit is contained in:
parent
d0b1770e51
commit
ea4b6c0f4b
@ -755,7 +755,7 @@ bool game_controller::load_game()
|
||||
return false;
|
||||
}
|
||||
|
||||
state_ = game_state(units_data_,cfg);
|
||||
state_ = game_state(units_data_, cfg, show_replay);
|
||||
|
||||
if(state_.version != game_config::version) {
|
||||
// do not load if too old, if either the savegame or the current game
|
||||
@ -2228,8 +2228,7 @@ static int play_game(int argc, char** argv)
|
||||
|
||||
//YogiHH:
|
||||
//init_config already processed the configs, so we don't need to do it for the
|
||||
//first loop pass. If for any reason calling reset_game_cfg is of any use then
|
||||
//take back the comments.
|
||||
//first loop pass.
|
||||
for(int first_time = true;;first_time = false){
|
||||
if (!first_time){
|
||||
//make sure the game config is always set to how it should be at the title screen
|
||||
|
@ -426,7 +426,7 @@ static player_info read_player(const game_data& data, const config* cfg)
|
||||
return res;
|
||||
}
|
||||
|
||||
game_state::game_state(const game_data& data, const config& cfg) :
|
||||
game_state::game_state(const game_data& data, const config& cfg, bool show_replay) :
|
||||
label(cfg["label"]),
|
||||
version(cfg["version"]),
|
||||
campaign_type(cfg["campaign_type"]),
|
||||
@ -460,7 +460,7 @@ game_state::game_state(const game_data& data, const config& cfg) :
|
||||
// We have to load era id for MP games so they can load correct era.
|
||||
|
||||
|
||||
if (snapshot != NULL && !snapshot->empty()) {
|
||||
if ((snapshot != NULL) && (!snapshot->empty()) && (!show_replay)) {
|
||||
|
||||
this->snapshot = *snapshot;
|
||||
|
||||
@ -470,7 +470,7 @@ game_state::game_state(const game_data& data, const config& cfg) :
|
||||
load_recall_list(data, snapshot->get_children("player"));
|
||||
|
||||
} else {
|
||||
// Start of scenario save and MP campaign network next scenario
|
||||
// Start of scenario save, replays and MP campaign network next scenario
|
||||
// have the recall list stored in root of the config.
|
||||
load_recall_list(data, cfg.get_children("player"));
|
||||
}
|
||||
@ -1255,6 +1255,17 @@ void game_state::set_menu_items(const config::child_list& menu_items) {
|
||||
}
|
||||
}
|
||||
|
||||
void player_info::debug(){
|
||||
LOG_NG << "Debugging player\n";
|
||||
LOG_NG << "\tName: " << name << "\n";
|
||||
LOG_NG << "\tGold: " << gold << "\n";
|
||||
LOG_NG << "\tAvailable units:\n";
|
||||
for (std::vector<unit>::const_iterator u = available_units.begin(); u != available_units.end(); u++){
|
||||
LOG_NG << "\t\t" + u->description() + "\n";
|
||||
}
|
||||
LOG_NG << "\tEnd available units\n";
|
||||
}
|
||||
|
||||
wml_menu_item::wml_menu_item(const std::string& id, const config* cfg) :
|
||||
name(),
|
||||
image(),
|
||||
|
@ -88,6 +88,8 @@ struct player_info
|
||||
//!< of the two.
|
||||
std::vector<unit> available_units; //!< Units the player may recall
|
||||
std::set<std::string> can_recruit; //!< Units the player has the ability to recruit
|
||||
|
||||
void debug();
|
||||
};
|
||||
|
||||
class game_state : public variable_set
|
||||
@ -120,7 +122,7 @@ public:
|
||||
{}
|
||||
|
||||
game_state(const game_state& state);
|
||||
game_state(const game_data& data, const config& cfg);
|
||||
game_state(const game_data& data, const config& cfg, bool show_replay = false);
|
||||
|
||||
~game_state();
|
||||
game_state& operator=(const game_state& state);
|
||||
|
Loading…
x
Reference in New Issue
Block a user