add warning if current_player attribute is specified by wml

specifying this attribute in [side] can result in assertion failure.
This commit is contained in:
gfgtdf 2016-03-08 23:14:04 +01:00
parent f4590e6bda
commit 4810e2c0ff
2 changed files with 7 additions and 1 deletions

View File

@ -168,6 +168,7 @@ void saved_game::write_general_info(config_writer& out) const
void saved_game::set_defaults()
{
const bool is_loaded_game = this->starting_pos_type_ != STARTINGPOS_SCENARIO;
const bool is_multiplayer_tag = classification().get_tagname() == "multiplayer";
static const std::vector<std::string> team_defaults = boost::assign::list_of
("carryover_percentage")
@ -184,6 +185,11 @@ void saved_game::set_defaults()
{
side["side_name"] = side["name"];
}
if(!is_loaded_game && !side["current_player"].empty())
{
ERR_NG << "Removed invalid 'current_player' attribute from [side] while loading a scenario. Consider using 'side_name' instead\n";
side["current_player"] = config::attribute_value();
}
// Set some team specific values to their defaults specified in scenario
BOOST_FOREACH(const std::string& att_name, team_defaults)
{

View File

@ -111,7 +111,7 @@ public:
void cancel_orders();
/* removes network_ai and network controller types*/
void unify_controllers();
/** does some post loading stuff must be used before passing the data to connect_engine */
void set_defaults();
replay_recorder_base& get_replay() { return replay_data_; }
const replay_recorder_base& get_replay() const { return replay_data_; }