mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-29 02:16:41 +00:00
Add a flag to record if the game encountered an OOS error.
This commit is contained in:
parent
f7d73e980e
commit
b9246dc6b4
@ -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
|
#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_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_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_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:
|
private:
|
||||||
std::string get_hash(const std::string& user);
|
std::string get_hash(const std::string& user);
|
||||||
|
@ -253,3 +253,7 @@ 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){
|
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;
|
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_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_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_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:
|
private:
|
||||||
std::string get_mail(const std::string& user);
|
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());
|
g.set_termination_reason((*info)["condition"].to_string());
|
||||||
if((*info)["condition"].to_string() == "out of sync") {
|
if((*info)["condition"].to_string() == "out of sync") {
|
||||||
g.send_server_message_to_all(player.name() + " reports out of sync errors.");
|
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_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_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_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:
|
protected:
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ CREATE TABLE extra
|
|||||||
-- MAP_NAME: the mp_scenario attribute value
|
-- MAP_NAME: the mp_scenario attribute value
|
||||||
-- ERA_NAME: the mp_era attribute value
|
-- ERA_NAME: the mp_era attribute value
|
||||||
-- REPLAY_NAME: the file name of the replay create when the game is ended
|
-- 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
|
create table game_info
|
||||||
(
|
(
|
||||||
INSTANCE_UUID CHAR(36) NOT NULL,
|
INSTANCE_UUID CHAR(36) NOT NULL,
|
||||||
@ -65,6 +66,7 @@ create table game_info
|
|||||||
MAP_NAME VARCHAR(255),
|
MAP_NAME VARCHAR(255),
|
||||||
ERA_NAME VARCHAR(255),
|
ERA_NAME VARCHAR(255),
|
||||||
REPLAY_NAME VARCHAR(255),
|
REPLAY_NAME VARCHAR(255),
|
||||||
|
OOS CHAR(1) NOT NULL DEFAULT 'N',
|
||||||
primary key (INSTANCE_UUID, GAME_ID)
|
primary key (INSTANCE_UUID, GAME_ID)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user