fix sides with no type= attribute

If you dont want that the engine uses the [side] wml table to create a
leader for that side, it is now enough to just omit the type attribute.
Previously it was necessary to add a no_leader=yes attribute.

The no_leader attribute is still used by the mp connect engine (which is
also used in sp) to prevent the mp connect engine from adding a random
leader from the current era. no_leader now defaults to yes for sides in
[scenario] and to no for sides in [multiplayer] so that the connect
engine now by default doesn't add a random mp leader to sides in sp
games.
This commit is contained in:
gfgtdf 2016-01-06 02:45:42 +01:00
parent acabc9201d
commit 163bdc9ecd
3 changed files with 6 additions and 2 deletions

View file

@ -271,6 +271,10 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload,
scenario["require_scenario"] = require_campaign;
// make force_lock_settings default to true for [scenario]
scenario["force_lock_settings"] = scenario["force_lock_settings"].to_bool(true);
BOOST_FOREACH(config& side, scenario.child_range("side"))
{
side["no_leader"] = side["no_leader"].to_bool(true);
}
}
}
}

View file

@ -365,7 +365,7 @@ void flg_manager::update_available_leaders()
{
available_leaders_.clear();
if (!side_["no_leader"].to_bool() || !leader_lock_) {
if (!default_leader_type_.empty() || !side_["no_leader"].to_bool() || !leader_lock_) {
int random_pos = 0;
// Add a default leader if there is one.

View file

@ -258,7 +258,7 @@ protected:
// this hack shall be removed, since it messes up with 'multiple leaders'
// If this side tag describes the leader of the side
if (!side_cfg_["no_leader"].to_bool() && side_cfg_["controller"] != "null") {
if (side_cfg_.has_attribute("type") && side_cfg_["type"] != "null" ) {
handle_leader(side_cfg_);
}
BOOST_FOREACH(const config &l, side_cfg_.child_range("leader")) {