Connect Engine: add flag for host side

This commit is contained in:
Charles Dang 2017-03-16 15:26:34 +11:00
parent 2813195985
commit 45a606556a
2 changed files with 7 additions and 1 deletions

View file

@ -1011,6 +1011,12 @@ config side_engine::new_config() const
// during the start/prestart event (otherwise random unit creation during prestart fails).
res["is_local"] = player_id_ == preferences::login() || controller_ == CNTR_COMPUTER || controller_ == CNTR_LOCAL;
// This function (new_config) is only meant to be called by the host's machine, which is why this check
// works. It essentially certifies that whatever side has the player_id that matches the host's login
// will be flagged. The reason we cannot check mp_campaign_info::is_host is because that flag is *always*
// true on the host's machine, meaning this flag would be set to true for every side.
res["is_host"] = player_id_ == preferences::login();
std::string desc = user_description();
if(!desc.empty()) {
res["user_description"] = t_string(desc, "wesnoth");

View file

@ -62,7 +62,7 @@ const std::set<std::string> team::attributes = {"ai_config",
"suppress_end_turn_confirmation",
"team_name", "user_team_name", "side_name", "village_gold", "village_support", "is_local",
// Multiplayer attributes.
"player_id", "action_bonus_count", "allow_changes", "allow_player", "color_lock",
"player_id", "is_host","action_bonus_count", "allow_changes", "allow_player", "color_lock",
"countdown_time", "disallow_observers", "faction",
"faction_from_recruit", "faction_name", "gold_lock", "income_lock",
"leader", "random_leader", "team_lock", "terrain_liked",