Fixed non-host players being unnotified about next_scenario data.

The players being unnotified resulted in them being able to press "End
Turn/End Scenario" button and downloading the current scenario data
instead of the next one.

Related code, which was marked as "deprecated", has been removed due to
not actually affecting anything.
This commit is contained in:
Andrius Silinskas 2013-09-13 18:17:59 +01:00
parent e3ceed9ee2
commit 2932d3088d
2 changed files with 8 additions and 15 deletions

View file

@ -154,14 +154,12 @@ std::string game::list_users(user_vector users, const std::string& func) const
}
void game::start_game(const player_map::const_iterator starter) {
// If the game was already started we're actually advancing.
const bool advance = started_;
started_ = true;
// Prevent inserting empty keys when reading.
const simple_wml::node& s = level_.root();
const bool save = s["savegame"].to_bool();
LOG_GAME << network::ip_address(starter->first) << "\t"
<< starter->second.name() << "\t" << (advance ? "advanced" : "started")
<< starter->second.name() << "\t" << "started"
<< (save ? " reloaded" : "") << " game:\t\"" << name_ << "\" (" << id_
<< ") with: " << list_users(players_, __func__) << ". Settings: map: " << s["id"]
<< "\tera: " << (s.child("era") ? (*s.child("era"))["id"] : "")
@ -213,12 +211,6 @@ void game::start_game(const player_map::const_iterator starter) {
end_turn_ = (turn - 1) * nsides_ + side - 1;
end_turn();
clear_history();
if (advance) {
// When the host advances tell everyone that the next scenario data is
// available.
static simple_wml::document notify_next_scenario("[notify_next_scenario]\n[/notify_next_scenario]\n", simple_wml::INIT_COMPRESSED);
send_data(notify_next_scenario, starter->first);
}
// Send [observer] tags for all observers that are already in the game.
send_observerjoins();
}

View file

@ -2515,15 +2515,16 @@ void server::process_data_game(const network::connection sock,
desc.set_attr("require_era", "no");
}
}
// Tell everyone that the next scenario data is available.
static simple_wml::document notify_next_scenario(
"[notify_next_scenario]\n[/notify_next_scenario]\n",
simple_wml::INIT_COMPRESSED);
g->send_data(notify_next_scenario, sock);
// Send the update of the game description to the lobby.
update_game_in_lobby(g);
return;
// If a player advances to the next scenario of a mp campaign. (deprecated)
///@deprecated r22619 a player advances to the next scenario of a mp campaign (notify_next_scenario)
} else if(data.child("notify_next_scenario")) {
//g->send_data(g->construct_server_message(pl->second.name()
// + " advanced to the next scenario."), sock);
return;
// A mp client sends a request for the next scenario of a mp campaign.
} else if (data.child("load_next_scenario")) {