Lock MP settings by default if "force_lock_settings" was set.
Previously, "Use map settings" along with "force_use_map_settings" were used for this.
This commit is contained in:
parent
afa9235fa1
commit
5a39c6ab24
8 changed files with 23 additions and 16 deletions
|
@ -38,11 +38,11 @@ std::string get_RC_suffix(const std::string& unit_color, const int color)
|
|||
|
||||
|
||||
flg_manager::flg_manager(const std::vector<const config*>& era_factions,
|
||||
const config& side, const bool map_settings, const bool saved_game,
|
||||
const config& side, const bool lock_settings, const bool saved_game,
|
||||
const int color) :
|
||||
era_factions_(era_factions),
|
||||
side_(side),
|
||||
map_settings_(map_settings),
|
||||
lock_settings_(lock_settings),
|
||||
saved_game_(saved_game),
|
||||
has_no_recruits_((side_.has_attribute("default_recruit") ?
|
||||
side_["default_recruit"].empty() : side_["recruit"].empty()) &&
|
||||
|
@ -313,7 +313,7 @@ void flg_manager::update_available_leaders()
|
|||
{
|
||||
available_leaders_.clear();
|
||||
|
||||
if (!side_["no_leader"].to_bool() || !map_settings_) {
|
||||
if (!side_["no_leader"].to_bool() || !lock_settings_) {
|
||||
// Add a default leader if there is one.
|
||||
if (!default_leader_type_.empty()) {
|
||||
available_leaders_.push_back(default_leader_type_);
|
||||
|
@ -407,7 +407,7 @@ void flg_manager::update_choosable_factions()
|
|||
{
|
||||
choosable_factions_ = available_factions_;
|
||||
|
||||
if ((!side_["faction"].empty() || !has_no_recruits_) && map_settings_) {
|
||||
if ((!side_["faction"].empty() || !has_no_recruits_) && lock_settings_) {
|
||||
std::string faction_id;
|
||||
if (!has_no_recruits_) {
|
||||
faction_id = "Custom";
|
||||
|
@ -425,7 +425,7 @@ void flg_manager::update_choosable_leaders()
|
|||
{
|
||||
choosable_leaders_ = available_leaders_;
|
||||
|
||||
if (!default_leader_type_.empty() && map_settings_) {
|
||||
if (!default_leader_type_.empty() && lock_settings_) {
|
||||
if (std::find(available_leaders_.begin(), available_leaders_.end(),
|
||||
default_leader_type_) != available_leaders_.end()) {
|
||||
|
||||
|
@ -439,7 +439,7 @@ void flg_manager::update_choosable_genders()
|
|||
{
|
||||
choosable_genders_ = available_genders_;
|
||||
|
||||
if (map_settings_) {
|
||||
if (lock_settings_) {
|
||||
std::string default_gender = side_["gender"];
|
||||
if (default_gender.empty() && !default_leader_type_.empty()) {
|
||||
const unit_type* unit = unit_types.find(current_leader_);
|
||||
|
|
|
@ -31,7 +31,7 @@ class flg_manager
|
|||
{
|
||||
public:
|
||||
flg_manager(const std::vector<const config*>& era_factions,
|
||||
const config& side, const bool map_settings, const bool saved_game,
|
||||
const config& side, const bool lock_settings, const bool saved_game,
|
||||
const int color);
|
||||
~flg_manager();
|
||||
|
||||
|
@ -105,7 +105,7 @@ private:
|
|||
|
||||
const config& side_;
|
||||
|
||||
const bool map_settings_;
|
||||
const bool lock_settings_;
|
||||
const bool saved_game_;
|
||||
const bool has_no_recruits_;
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ configure::configure(game_display& disp, const config &cfg, chat& c, config& gam
|
|||
xp_modifier_slider_.set_increment(10);
|
||||
xp_modifier_slider_.set_help_string(_("The amount of experience a unit needs to advance"));
|
||||
|
||||
if (parameters_.scenario_data["force_use_map_settings"].to_bool()) {
|
||||
if (parameters_.scenario_data["force_lock_settings"].to_bool()) {
|
||||
use_map_settings_.enable(false);
|
||||
use_map_settings_.set_check(true);
|
||||
} else {
|
||||
|
|
|
@ -50,13 +50,13 @@ connect::side::side(connect& parent, side_engine_ptr engine) :
|
|||
parent_(&parent),
|
||||
engine_(engine),
|
||||
gold_lock_(engine_->cfg()["gold_lock"].to_bool(
|
||||
parent_->params().use_map_settings)),
|
||||
parent_->force_lock_settings())),
|
||||
income_lock_(engine_->cfg()["income_lock"].to_bool(
|
||||
parent_->params().use_map_settings)),
|
||||
parent_->force_lock_settings())),
|
||||
team_lock_(engine_->cfg()["team_lock"].to_bool(
|
||||
parent_->params().use_map_settings)),
|
||||
parent_->force_lock_settings())),
|
||||
color_lock_(engine_->cfg()["color_lock"].to_bool(
|
||||
parent_->params().use_map_settings)),
|
||||
parent_->force_lock_settings())),
|
||||
changed_(false),
|
||||
label_player_number_(parent.video(), str_cast(engine_->index() + 1),
|
||||
font::SIZE_LARGE, font::LOBBY_COLOR),
|
||||
|
|
|
@ -123,6 +123,7 @@ private:
|
|||
void update_playerlist_state(bool silent = true);
|
||||
|
||||
const mp_game_settings& params() { return engine_.params(); }
|
||||
bool force_lock_settings() const { return engine_.force_lock_settings(); }
|
||||
|
||||
// Lists used for combos.
|
||||
std::vector<std::string> player_colors_;
|
||||
|
|
|
@ -75,6 +75,7 @@ connect_engine::connect_engine(game_display& disp, game_state& state,
|
|||
default_controller_(local_players_only ? CNTR_LOCAL: CNTR_NETWORK),
|
||||
local_players_only_(local_players_only),
|
||||
first_scenario_(first_scenario),
|
||||
force_lock_settings_(),
|
||||
side_engines_(),
|
||||
era_factions_(),
|
||||
team_names_(),
|
||||
|
@ -88,6 +89,8 @@ connect_engine::connect_engine(game_display& disp, game_state& state,
|
|||
return;
|
||||
}
|
||||
|
||||
force_lock_settings_ = level_["force_lock_settings"].to_bool();
|
||||
|
||||
// Original level sides.
|
||||
config::child_itors sides = current_config()->child_range("side");
|
||||
|
||||
|
@ -831,7 +834,7 @@ side_engine::side_engine(const config& cfg, connect_engine& parent_engine,
|
|||
allow_player_(cfg["allow_player"].to_bool(true)),
|
||||
allow_changes_(cfg["allow_changes"].to_bool(true)),
|
||||
controller_lock_(cfg["controller_lock"].to_bool(
|
||||
parent_.params_.use_map_settings)),
|
||||
parent_.force_lock_settings_)),
|
||||
index_(index),
|
||||
team_(0),
|
||||
color_(index),
|
||||
|
@ -840,7 +843,7 @@ side_engine::side_engine(const config& cfg, connect_engine& parent_engine,
|
|||
current_player_(cfg["current_player"]),
|
||||
player_id_(cfg["player_id"]),
|
||||
ai_algorithm_(),
|
||||
flg_(parent_.era_factions_, cfg_, parent_.params_.use_map_settings,
|
||||
flg_(parent_.era_factions_, cfg_, parent_.force_lock_settings_,
|
||||
parent_.params_.saved_game, color_)
|
||||
{
|
||||
// Check if this side should give its control to some other side.
|
||||
|
|
|
@ -91,6 +91,7 @@ public:
|
|||
std::vector<side_engine_ptr>& side_engines() { return side_engines_; }
|
||||
const mp_game_settings& params() const { return params_; }
|
||||
bool first_scenario() const { return first_scenario_; }
|
||||
bool force_lock_settings() const { return force_lock_settings_; }
|
||||
|
||||
private:
|
||||
connect_engine(const connect_engine&);
|
||||
|
@ -114,6 +115,8 @@ private:
|
|||
const bool local_players_only_;
|
||||
const bool first_scenario_;
|
||||
|
||||
bool force_lock_settings_;
|
||||
|
||||
std::vector<side_engine_ptr> side_engines_;
|
||||
std::vector<const config*> era_factions_;
|
||||
std::vector<std::string> team_names_;
|
||||
|
|
|
@ -576,7 +576,7 @@ LEVEL_RESULT play_game(game_display& disp, game_state& gamestate,
|
|||
params.num_turns = (*scenario)["turns"].to_int(-1);
|
||||
params.saved_game = false;
|
||||
params.use_map_settings =
|
||||
(*scenario)["force_use_map_settings"].to_bool(true);
|
||||
(*scenario)["force_lock_settings"].to_bool();
|
||||
|
||||
mp::connect_engine_ptr
|
||||
connect_engine(new mp::connect_engine(disp, gamestate,
|
||||
|
|
Loading…
Add table
Reference in a new issue