mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-04 21:17:55 +00:00
Changed the scope of side controller lock.
The lock is now per side, not per scenario. The lock has also been renamed to "controller_lock". Additionally, the game should now not apply a lock if "controller" attribute was empty.
This commit is contained in:
parent
31312e986b
commit
94ffdcfe69
14
changelog
14
changelog
@ -72,12 +72,14 @@ Version 1.11.6+dev:
|
||||
* Update game's side data, slots and state in server during next scenario
|
||||
initialization.
|
||||
* Fixed reserved sides being counted as available in server.
|
||||
* Added possibility to lock side controllers in MP Connect screen. The lock
|
||||
provides a way to be sure that sides will be played with a controller
|
||||
which was assigned in WML. I.e. if "controller" was set to "ai", it won't
|
||||
be possible to select any other controller for a side. However, if
|
||||
"controller" was set to "human", it will still be possible to assign any
|
||||
player, local, network or reserved (if applicable) controller.
|
||||
* Added "controller_lock" in SideWML. The lock provides a way to be sure
|
||||
that sides will be played with a controller which was assigned in WML.
|
||||
I.e. if "controller" was set to "ai", it won't be possible to select any
|
||||
other controller for a side. However, if "controller" was set to "human",
|
||||
it will still be possible to assign any player, local, network or
|
||||
reserved (if applicable) controller.
|
||||
* All multiplayer locks in SideWML (e.g. "team_lock"), now uses "Use map
|
||||
settings" as their default value.
|
||||
* WML engine:
|
||||
* New [disable] weapon special.
|
||||
* New variation_id attribute with the function of former variation_name.
|
||||
|
@ -75,7 +75,6 @@ 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),
|
||||
lock_side_controllers_(),
|
||||
side_engines_(),
|
||||
era_factions_(),
|
||||
team_names_(),
|
||||
@ -164,9 +163,6 @@ connect_engine::connect_engine(game_display& disp, game_state& state,
|
||||
era_factions_.push_back(&era);
|
||||
}
|
||||
|
||||
lock_side_controllers_ =
|
||||
level_["lock_side_controllers"].to_bool(params_.use_map_settings);
|
||||
|
||||
// Create side engines.
|
||||
int index = 0;
|
||||
BOOST_FOREACH(const config &s, sides) {
|
||||
@ -795,6 +791,8 @@ side_engine::side_engine(const config& cfg, connect_engine& parent_engine,
|
||||
controller_options_(),
|
||||
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)),
|
||||
index_(index),
|
||||
team_(0),
|
||||
color_(index),
|
||||
@ -1074,22 +1072,12 @@ bool side_engine::swap_sides_on_drop_target(const int drop_target) {
|
||||
const std::string target_ai =
|
||||
parent_.side_engines_[drop_target]->ai_algorithm_;
|
||||
|
||||
if (parent_.lock_side_controllers_) {
|
||||
switch (target_controller) {
|
||||
case CNTR_NETWORK:
|
||||
case CNTR_LOCAL:
|
||||
case CNTR_RESERVED:
|
||||
if (controller_ != CNTR_NETWORK && controller_ != CNTR_LOCAL &&
|
||||
controller_ != CNTR_RESERVED) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (controller_ != target_controller) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ((controller_lock_ ||
|
||||
parent_.side_engines_[drop_target]->controller_lock_) &&
|
||||
(controller_options_ !=
|
||||
parent_.side_engines_[drop_target]->controller_options_)) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
parent_.side_engines_[drop_target]->ai_algorithm_ = ai_algorithm_;
|
||||
@ -1250,7 +1238,7 @@ void side_engine::set_controller_commandline(const std::string& controller_name)
|
||||
void side_engine::add_controller_option(mp::controller controller,
|
||||
const std::string& name, const std::string& controller_value)
|
||||
{
|
||||
if (parent_.lock_side_controllers_ &&
|
||||
if (controller_lock_ && !cfg_["controller"].empty() &&
|
||||
cfg_["controller"] != controller_value) {
|
||||
|
||||
return;
|
||||
|
@ -114,8 +114,6 @@ private:
|
||||
const bool local_players_only_;
|
||||
const bool first_scenario_;
|
||||
|
||||
bool lock_side_controllers_;
|
||||
|
||||
std::vector<side_engine_ptr> side_engines_;
|
||||
std::vector<const config*> era_factions_;
|
||||
std::vector<std::string> team_names_;
|
||||
@ -209,6 +207,7 @@ private:
|
||||
|
||||
const bool allow_player_;
|
||||
const bool allow_changes_;
|
||||
const bool controller_lock_;
|
||||
|
||||
int index_;
|
||||
int team_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user