Revert "Connect Engine: include no_leader key in player allowed check"

This reverts commit ecaec3bf07.
This commit is contained in:
Charles Dang 2016-10-12 01:44:39 +11:00
parent 0d864e07ac
commit 3cd9d34369
2 changed files with 9 additions and 9 deletions

View file

@ -161,7 +161,7 @@ connect_engine::connect_engine(saved_game& state,
"Team " + side_str);
user_team_names_.push_back(user_team_name.t_str().to_serialized());
if((side["allow_player"].to_bool(true) && !side["no_leader"].to_bool(false)) || game_config::debug) {
if (side["allow_player"].to_bool(true) || game_config::debug) {
player_teams_.push_back(user_team_name.str());
}
}
@ -877,6 +877,7 @@ side_engine::side_engine(const config& cfg, connect_engine& parent_engine,
controller_(CNTR_NETWORK),
current_controller_index_(0),
controller_options_(),
allow_player_(cfg["allow_player"].to_bool(true)),
controller_lock_(cfg["controller_lock"].to_bool(
parent_.force_lock_settings_) && parent_.params_.use_map_settings),
index_(index),
@ -947,7 +948,7 @@ side_engine::side_engine(const config& cfg, connect_engine& parent_engine,
// Reserve a side for "current_player", unless the side
// is played by an AI.
set_controller(CNTR_RESERVED);
} else if (allow_player()) {
} else if (allow_player_) {
set_controller(parent_.default_controller_);
} else {
// AI is the default.
@ -1012,7 +1013,7 @@ std::string side_engine::user_description() const
case CNTR_LOCAL:
return N_("Anonymous player");
case CNTR_COMPUTER:
if (allow_player()) {
if (allow_player_) {
return ai::configuration::get_ai_config_for(ai_algorithm_)["description"];
} else {
return N_("Computer Player");
@ -1060,7 +1061,7 @@ config side_engine::new_config() const
}
assert(controller_ != CNTR_LAST);
if(controller_ == CNTR_COMPUTER && allow_player()) {
if(controller_ == CNTR_COMPUTER && allow_player_) {
// Do not import default ai cfg otherwise - all is set by scenario config.
res.add_child_at("ai", config_of("ai_algorithm", ai_algorithm_), 0);
}
@ -1158,7 +1159,7 @@ config side_engine::new_config() const
if ((res["user_team_name"] == "") || (!parent_.params_.use_map_settings)) {
res["user_team_name"] = parent_.user_team_names_[team_];
}
res["allow_player"] = cfg_["allow_player"].to_bool(true);
res["allow_player"] = allow_player_;
res["color"] = get_color(color_);
res["gold"] = gold_;
res["income"] = income_;
@ -1184,7 +1185,7 @@ config side_engine::new_config() const
bool side_engine::ready_for_start() const
{
if (!allow_player()) {
if (!allow_player_) {
// Sides without players are always ready.
return true;
}

View file

@ -213,9 +213,7 @@ public:
const std::string& ai_algorithm() const { return ai_algorithm_; }
void set_ai_algorithm(const std::string& ai_algorithm)
{ ai_algorithm_ = ai_algorithm; }
bool allow_player() const {
return cfg_["allow_player"].to_bool(true) && !cfg_["no_leader"].to_bool(false);
}
bool allow_player() const { return allow_player_; }
bool allow_changes() const { return allow_changes_; }
bool waiting_to_choose_faction() const { return waiting_to_choose_faction_; }
void set_waiting_to_choose_status(bool status) { waiting_to_choose_faction_ = status;}
@ -255,6 +253,7 @@ private:
unsigned current_controller_index_;
std::vector<controller_option> controller_options_;
const bool allow_player_;
const bool controller_lock_;
int index_;