* separate out of sync termination reasons by the era used

This commit is contained in:
Gunter Labes 2008-03-22 12:12:36 +00:00
parent 0b7edc8e8e
commit 56e0885562
3 changed files with 13 additions and 10 deletions

View file

@ -1144,6 +1144,17 @@ void game::set_description(simple_wml::node* desc) {
}
}
void game::set_termination_reason(const std::string& reason) {
if (reason == "out of sync") {
simple_wml::string_span era;
if (level_.child("era")) {
era = level_.child("era")->attr("id");
}
termination_ = "out of sync - " + era.to_string();
}
if (termination_.empty()) { termination_ = reason; }
}
void game::add_players(const game& other_game, const bool observer) {
user_vector users = other_game.all_game_users();
if (observer){

View file

@ -116,9 +116,7 @@ public:
return started_ ? (termination_.empty() ? aborted : termination_) : not_started;
}
void set_termination_reason(const std::string& reason) {
if (termination_.empty()) { termination_ = reason; }
}
void set_termination_reason(const std::string& reason);
private:
//forbidden operations

View file

@ -725,7 +725,7 @@ void server::process_login(const network::connection sock,
send_error(sock, "This username is too long. Usernames must be 18 characers or less.");
return;
}
// Check if the uername is allowed.
// Check if the username is allowed.
for (std::vector<std::string>::const_iterator d_it = disallowed_names_.begin();
d_it != disallowed_names_.end(); ++d_it)
{
@ -1438,12 +1438,6 @@ void server::process_data_game(const network::connection sock,
const simple_wml::node& info = *data.child("info");
if (info["type"] == "termination") {
g->set_termination_reason(info["condition"].to_string());
if (info["condition"] == "out of sync") {
// May be too noisy..
LOG_SERVER << network::ip_address(sock) << "\t" << pl->second.name()
<< "\treports an out of sync error in game:\t\""
<< g->name() << "\" (" << g->id() << ").\n";
}
}
return;
} else if (data.child("turn")) {