fix tournament metadata linking through server restarts

This commit is contained in:
Martin Michelsen
2023-08-30 18:44:45 -07:00
parent 2304a17dd0
commit eab453413e
+8 -3
View File
@@ -231,6 +231,12 @@ static void send_main_menu(shared_ptr<ServerState> s, shared_ptr<Client> c) {
}
void on_login_complete(shared_ptr<ServerState> s, shared_ptr<Client> c) {
if (c->flags & Client::Flag::IS_EPISODE_3) {
auto team = s->ep3_tournament_index->team_for_serial_number(c->license->serial_number);
auto tourn = team ? team->tournament.lock() : nullptr;
c->ep3_tournament_team = team;
}
// On the BB data server, this function is called only on the last connection
// (when we should send the ship select menu).
if ((c->server_behavior == ServerBehavior::LOGIN_SERVER) ||
@@ -2498,10 +2504,9 @@ static void on_61_98(shared_ptr<ServerState> s, shared_ptr<Client> c,
// login sequence.
if ((c->flags & Client::Flag::IS_EPISODE_3) && !(c->flags & Client::Flag::HAS_EP3_CARD_DEFS)) {
send_ep3_card_list_update(s, c);
auto team = s->ep3_tournament_index->team_for_serial_number(c->license->serial_number);
auto team = c->ep3_tournament_team.lock();
auto tourn = team ? team->tournament.lock() : nullptr;
c->ep3_tournament_team = team;
if (!(c->flags & Client::Flag::IS_EP3_TRIAL_EDITION)) {
if (tourn && !(c->flags & Client::Flag::IS_EP3_TRIAL_EDITION)) {
send_ep3_confirm_tournament_entry(s, c, tourn);
}
}