Fixes for factions, leaders and genders in networked games.
There was some oversight when changes to factions, leaders and genders set up were made and as a result, in some cases, things were seriously broken. This is an attempt to fix existing major problems. Some minor problems still need to be addressed. Specifically, this commit should fix problems with showing different factions, leaders and genders lists for non-host and host players for the same sides. And it should also avoid a situation where non-host player sees a "Custom" faction even if it should not appear.
This commit is contained in:
parent
9db21dbeee
commit
4784530759
3 changed files with 14 additions and 5 deletions
|
@ -44,8 +44,11 @@ flg_manager::flg_manager(const std::vector<const config*>& era_factions,
|
|||
side_(side),
|
||||
lock_settings_(lock_settings),
|
||||
saved_game_(saved_game),
|
||||
has_no_recruits_((side_.has_attribute("default_recruit") ?
|
||||
side_["default_recruit"].empty() : side_["recruit"].empty()) &&
|
||||
has_no_recruits_(
|
||||
((side_.has_attribute("default_recruit") ?
|
||||
side_["default_recruit"].empty() :
|
||||
side_["recruit"].empty()) ||
|
||||
side_["no_recruit"].to_bool()) &&
|
||||
side_["previous_recruits"].empty() && side_["extra_recruit"].empty()),
|
||||
color_(color),
|
||||
available_factions_(),
|
||||
|
|
|
@ -49,6 +49,8 @@ const std::string controller_names[] = {
|
|||
|
||||
const std::string attributes_to_trim[] = {
|
||||
"side",
|
||||
"type",
|
||||
"gender",
|
||||
"recruit",
|
||||
"extra_recruit",
|
||||
"previous_recruits",
|
||||
|
@ -919,7 +921,11 @@ 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"];
|
||||
if (res["default_recruit"].empty()) {
|
||||
res["no_recruit"] = true;
|
||||
}
|
||||
|
||||
// If the user is allowed to change type, faction, leader etc,
|
||||
// then import their new values in the config.
|
||||
|
|
|
@ -310,12 +310,12 @@ void wait::join_game(bool observe)
|
|||
era_factions.push_back(&side);
|
||||
}
|
||||
|
||||
const bool map_settings =
|
||||
level_.child("multiplayer")["mp_use_map_settings"].to_bool();
|
||||
const bool lock_settings =
|
||||
level_["force_lock_settings"].to_bool();
|
||||
const bool saved_game =
|
||||
level_.child("multiplayer")["savegame"].to_bool();
|
||||
|
||||
flg_manager flg(era_factions, *side_choice, map_settings,
|
||||
flg_manager flg(era_factions, *side_choice, lock_settings,
|
||||
saved_game, color);
|
||||
|
||||
std::vector<std::string> choices;
|
||||
|
|
Loading…
Add table
Reference in a new issue