automatically delete tournaments when complete

This commit is contained in:
Martin Michelsen
2022-12-08 17:32:33 -08:00
parent 2eacaa993e
commit 93f42a9398
3 changed files with 8 additions and 3 deletions
+6 -1
View File
@@ -1058,7 +1058,12 @@ static void on_ep3_server_data_request(shared_ptr<ServerState> s, shared_ptr<Cli
} else {
throw logic_error("invalid winner team id");
}
send_ep3_tournament_match_result_result(l, l->tournament_match);
send_ep3_tournament_match_result(l, l->tournament_match);
auto tourn = l->tournament_match->tournament.lock();
if (tourn && (tourn->get_state() == Episode3::Tournament::State::COMPLETE)) {
s->ep3_tournament_index->delete_tournament(tourn->get_number());
}
}
}
+1 -1
View File
@@ -2101,7 +2101,7 @@ void send_ep3_set_tournament_player_decks(
// TODO: Handle disconnection during the match (the other team should win)
}
void send_ep3_tournament_match_result_result(
void send_ep3_tournament_match_result(
shared_ptr<Lobby> l, shared_ptr<const Episode3::Tournament::Match> match) {
auto tourn = match->tournament.lock();
if (!tourn) {
+1 -1
View File
@@ -322,7 +322,7 @@ void send_ep3_set_tournament_player_decks(
std::shared_ptr<Lobby> l,
std::shared_ptr<Client> c,
std::shared_ptr<const Episode3::Tournament::Match> match);
void send_ep3_tournament_match_result_result(
void send_ep3_tournament_match_result(
std::shared_ptr<Lobby> l,
std::shared_ptr<const Episode3::Tournament::Match> match);