Add a flag to record if the game encountered an OOS error.
This commit is contained in:
parent
511553ddd4
commit
0dae5c5097
7 changed files with 21 additions and 0 deletions
|
@ -482,4 +482,13 @@ void fuh::db_insert_modification_info(const std::string& uuid, int game_id, cons
|
|||
}
|
||||
}
|
||||
|
||||
void fuh::db_set_oos_flag(const std::string& uuid, int game_id){
|
||||
try {
|
||||
prepared_statement<void>("UPDATE `" + db_game_info_table_ + "` SET OOS = 'Y' WHERE INSTANCE_UUID = ? AND GAME_ID = ?",
|
||||
uuid, game_id);
|
||||
} catch (const sql_error& e) {
|
||||
ERR_UH << "Could not update the game's OOS flag on table `" + db_game_info_table_ + "`:" << e.message << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
#endif //HAVE_MYSQLPP
|
||||
|
|
|
@ -87,6 +87,7 @@ class fuh : public user_handler {
|
|||
void db_update_game_end(const std::string& uuid, int game_id, const std::string& replay_location);
|
||||
void db_insert_game_player_info(const std::string& uuid, int game_id, const std::string& username, int side_number, const std::string& is_host, const std::string& faction);
|
||||
void db_insert_modification_info(const std::string& uuid, int game_id, const std::string& modification_name);
|
||||
void db_set_oos_flag(const std::string& uuid, int game_id);
|
||||
|
||||
private:
|
||||
std::string get_hash(const std::string& user);
|
||||
|
|
|
@ -252,4 +252,8 @@ void suh::db_insert_game_player_info(const std::string& uuid, int game_id, const
|
|||
}
|
||||
void suh::db_insert_modification_info(const std::string& uuid, int game_id, const std::string& modification_name){
|
||||
std::cout << uuid << " - " << game_id << " - " << modification_name << std::endl;
|
||||
}
|
||||
|
||||
void suh::db_set_oos_flag(const std::string& uuid, int game_id){
|
||||
std::cout << uuid << " - " << game_id << " - " << "OOS occurred!" << std::endl;
|
||||
}
|
|
@ -73,6 +73,7 @@ class suh : public user_handler {
|
|||
void db_update_game_end(const std::string& uuid, int game_id, const std::string& replay_location);
|
||||
void db_insert_game_player_info(const std::string& uuid, int game_id, const std::string& username, int side_number, const std::string& is_host, const std::string& faction);
|
||||
void db_insert_modification_info(const std::string& uuid, int game_id, const std::string& modification_name);
|
||||
void db_set_oos_flag(const std::string& uuid, int game_id);
|
||||
|
||||
private:
|
||||
std::string get_mail(const std::string& user);
|
||||
|
|
|
@ -1859,6 +1859,9 @@ void server::handle_player_in_game(socket_ptr socket, std::shared_ptr<simple_wml
|
|||
g.set_termination_reason((*info)["condition"].to_string());
|
||||
if((*info)["condition"].to_string() == "out of sync") {
|
||||
g.send_server_message_to_all(player.name() + " reports out of sync errors.");
|
||||
if(user_handler_){
|
||||
user_handler_->db_set_oos_flag(uuid_, g.id());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -177,6 +177,7 @@ class user_handler {
|
|||
virtual void db_update_game_end(const std::string& uuid, int game_id, const std::string& replay_location) =0;
|
||||
virtual void db_insert_game_player_info(const std::string& uuid, int game_id, const std::string& username, int side_number, const std::string& is_host, const std::string& faction) =0;
|
||||
virtual void db_insert_modification_info(const std::string& uuid, int game_id, const std::string& modification_name) =0;
|
||||
virtual void db_set_oos_flag(const std::string& uuid, int game_id) =0;
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ CREATE TABLE extra
|
|||
-- MAP_NAME: the mp_scenario attribute value
|
||||
-- ERA_NAME: the mp_era attribute value
|
||||
-- REPLAY_NAME: the file name of the replay create when the game is ended
|
||||
-- OOS: Y/N flag of whether the game encountered an OOS error
|
||||
create table game_info
|
||||
(
|
||||
INSTANCE_UUID CHAR(36) NOT NULL,
|
||||
|
@ -65,6 +66,7 @@ create table game_info
|
|||
MAP_NAME VARCHAR(255),
|
||||
ERA_NAME VARCHAR(255),
|
||||
REPLAY_NAME VARCHAR(255),
|
||||
OOS CHAR(1) NOT NULL DEFAULT 'N',
|
||||
primary key (INSTANCE_UUID, GAME_ID)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue