fix faction_from_recruit
Previously faction_from_recruit would search for default_recruit= in [multiplayer_side]. This commit fixes it so that it seached for 'recruit' ('default recruit' is no attribute of [multiplayer_side]). This fixed behaviour breaks 'A new land' mp scenario becasue the faction now gets locked to the mp faction that matches the recruits best (loyalists), but in ANL we wants custon recruitlist and not Loyalists recruitlist. To Fix this i removed faction_from_recruit= from 'A new land's sides.
This commit is contained in:
parent
e9acbd1d19
commit
61fab699e5
4 changed files with 18 additions and 13 deletions
|
@ -58,7 +58,6 @@
|
|||
shroud=no
|
||||
fog=yes
|
||||
recruit=Peasant,Mage
|
||||
faction_from_recruit=yes
|
||||
faction_lock=yes
|
||||
[/side]
|
||||
|
||||
|
@ -74,7 +73,6 @@
|
|||
shroud=no
|
||||
fog=yes
|
||||
recruit=Peasant,Mage
|
||||
faction_from_recruit=yes
|
||||
faction_lock=yes
|
||||
[/side]
|
||||
|
||||
|
@ -90,7 +88,6 @@
|
|||
shroud=no
|
||||
fog=yes
|
||||
recruit=Peasant,Mage
|
||||
faction_from_recruit=yes
|
||||
faction_lock=yes
|
||||
[/side]
|
||||
|
||||
|
@ -106,7 +103,6 @@
|
|||
shroud=no
|
||||
fog=yes
|
||||
recruit=Peasant,Mage
|
||||
faction_from_recruit=yes
|
||||
faction_lock=yes
|
||||
[/side]
|
||||
|
||||
|
|
|
@ -963,7 +963,7 @@ config side_engine::new_config() const
|
|||
// Save default "recruit" so that correct faction lists would be
|
||||
// initialized by flg_manager when the new side config is sent over network.
|
||||
// In case recruit list was empty, set a flag to indicate that.
|
||||
res["default_recruit"] = cfg_["recruit"];
|
||||
res["default_recruit"] = cfg_["recruit"].str();
|
||||
if (res["default_recruit"].empty()) {
|
||||
res["no_recruit"] = true;
|
||||
}
|
||||
|
|
|
@ -52,12 +52,7 @@ flg_manager::flg_manager(const std::vector<const config*>& era_factions,
|
|||
side_(side),
|
||||
use_map_settings_(use_map_settings),
|
||||
saved_game_(saved_game),
|
||||
has_no_recruits_(
|
||||
((side_.has_attribute("default_recruit") ?
|
||||
side_["default_recruit"].empty() :
|
||||
side_["recruit"].empty()) ||
|
||||
side_["no_recruit"].to_bool()) &&
|
||||
side_["previous_recruits"].empty()),
|
||||
has_no_recruits_(get_original_recruits(side_).empty() && side_["previous_recruits"].empty()),
|
||||
faction_lock_(side_["faction_lock"].to_bool(lock_settings) && use_map_settings),
|
||||
leader_lock_(side_["leader_lock"].to_bool(lock_settings) && use_map_settings),
|
||||
available_factions_(),
|
||||
|
@ -531,8 +526,8 @@ int flg_manager::find_suitable_faction() const
|
|||
search_field = "id";
|
||||
} else if (side_["faction_from_recruit"].to_bool()) {
|
||||
// Choose based on recruit.
|
||||
find = utils::split(side_["default_recruit"]);
|
||||
search_field = "default_recruit";
|
||||
find = get_original_recruits(side_);
|
||||
search_field = "recruit";
|
||||
} else if (const config::attribute_value *l = side_.get("leader")) {
|
||||
// Choose based on leader.
|
||||
find.push_back(*l);
|
||||
|
@ -628,4 +623,17 @@ void flg_manager::set_current_gender(const std::string& gender)
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> flg_manager::get_original_recruits(const config& cfg)
|
||||
{
|
||||
if (cfg["no_recruits"].to_bool()) {
|
||||
return std::vector<std::string>();
|
||||
}
|
||||
const config::attribute_value& cfg_default_recruit = cfg["default_recruit"];
|
||||
if (!cfg_default_recruit.empty()) {
|
||||
return utils::split(cfg_default_recruit.str());
|
||||
}
|
||||
else {
|
||||
return utils::split(cfg["recruit"].str());
|
||||
}
|
||||
}
|
||||
} // end namespace ng
|
||||
|
|
|
@ -131,6 +131,7 @@ private:
|
|||
std::string default_leader_type_;
|
||||
std::string default_leader_gender_;
|
||||
const config* default_leader_cfg_;
|
||||
static std::vector<std::string> get_original_recruits(const config& cfg);
|
||||
};
|
||||
|
||||
} // end namespace ng
|
||||
|
|
Loading…
Add table
Reference in a new issue