don't send tournament state to Ep3 trial edition clients

This commit is contained in:
Martin Michelsen
2023-08-13 19:11:17 -07:00
parent f657012d8e
commit 9b66e07c06
2 changed files with 13 additions and 9 deletions
+8 -8
View File
@@ -235,8 +235,10 @@ void on_login_complete(shared_ptr<ServerState> s, shared_ptr<Client> c) {
auto team = s->ep3_tournament_index->team_for_serial_number(c->license->serial_number); auto team = s->ep3_tournament_index->team_for_serial_number(c->license->serial_number);
auto tourn = team ? team->tournament.lock() : nullptr; auto tourn = team ? team->tournament.lock() : nullptr;
c->ep3_tournament_team = team; c->ep3_tournament_team = team;
if (!(c->flags & Client::Flag::IS_TRIAL_EDITION)) {
send_ep3_confirm_tournament_entry(s, c, tourn); send_ep3_confirm_tournament_entry(s, c, tourn);
} }
}
// On the BB data server, this function is called only on the last connection // On the BB data server, this function is called only on the last connection
// (when we should send the ship select menu). // (when we should send the ship select menu).
@@ -1255,13 +1257,11 @@ static void on_tournament_bracket_updated(
for (const auto& l : s->all_lobbies()) { for (const auto& l : s->all_lobbies()) {
for (const auto& c : l->clients) { for (const auto& c : l->clients) {
if (!c) { if (!c ||
continue; !c->license ||
} !serial_numbers.count(c->license->serial_number) ||
if (!c->license || !serial_numbers.count(c->license->serial_number)) { c->ep3_tournament_team.expired() ||
continue; (c->flags & Client::Flag::IS_TRIAL_EDITION)) {
}
if (c->ep3_tournament_team.expired()) {
continue; continue;
} }
send_ep3_confirm_tournament_entry(s, c, tourn); send_ep3_confirm_tournament_entry(s, c, tourn);
@@ -1830,7 +1830,7 @@ static void on_10(shared_ptr<ServerState> s, shared_ptr<Client> c,
} else { } else {
// Clear Check Tactics menu so client won't see newserv tournament // Clear Check Tactics menu so client won't see newserv tournament
// state while logically on another server // state while logically on another server
if (c->flags & Client::Flag::IS_EPISODE_3) { if ((c->flags & Client::Flag::IS_EPISODE_3) && !(c->flags & Client::Flag::IS_TRIAL_EDITION)) {
send_ep3_confirm_tournament_entry(s, c, nullptr); send_ep3_confirm_tournament_entry(s, c, nullptr);
} }
+4
View File
@@ -2254,6 +2254,10 @@ void send_ep3_confirm_tournament_entry(
shared_ptr<ServerState> s, shared_ptr<ServerState> s,
shared_ptr<Client> c, shared_ptr<Client> c,
shared_ptr<const Episode3::Tournament> tourn) { shared_ptr<const Episode3::Tournament> tourn) {
if (c->flags & Client::Flag::IS_TRIAL_EDITION) {
throw runtime_error("cannot send tournament entry command to Episode 3 Trial Edition client");
}
S_ConfirmTournamentEntry_GC_Ep3_CC cmd; S_ConfirmTournamentEntry_GC_Ep3_CC cmd;
if (tourn) { if (tourn) {
cmd.tournament_name = tourn->get_name(); cmd.tournament_name = tourn->get_name();