separate out of sync termination reasons by the era used
This commit is contained in:
parent
a586100484
commit
da607317c0
3 changed files with 13 additions and 10 deletions
|
@ -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){
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -738,7 +738,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)
|
||||
{
|
||||
|
@ -1451,12 +1451,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")) {
|
||||
|
|
Loading…
Add table
Reference in a new issue