disband spectator teams when primary players go to results screen
This commit is contained in:
@@ -2066,6 +2066,12 @@ void Server::handle_CAx21_end_battle(const string& data) {
|
||||
in_cmd.header.subsubcommand, "END BATTLE");
|
||||
if (this->setup_phase == SetupPhase::BATTLE_ENDED) {
|
||||
this->battle_finished = true;
|
||||
|
||||
// This logic isn't part of the original implementation.
|
||||
auto l = this->lobby.lock();
|
||||
if (l) {
|
||||
send_ep3_disband_watcher_lobbies(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2811,6 +2811,16 @@ void send_ep3_card_auction(shared_ptr<ServerState> s, shared_ptr<Lobby> l) {
|
||||
send_command_t(l, 0xEF, num_cards, cmd);
|
||||
}
|
||||
|
||||
void send_ep3_disband_watcher_lobbies(shared_ptr<Lobby> primary_l) {
|
||||
for (auto watcher_l : primary_l->watcher_lobbies) {
|
||||
if (!watcher_l->is_ep3()) {
|
||||
throw logic_error("spectator team is not an Episode 3 lobby");
|
||||
}
|
||||
primary_l->log.info("Disbanding watcher lobby %" PRIX32, watcher_l->lobby_id);
|
||||
send_command(watcher_l, 0xED, 0x00);
|
||||
}
|
||||
}
|
||||
|
||||
void send_server_time(shared_ptr<Client> c) {
|
||||
uint64_t t = now();
|
||||
|
||||
|
||||
+1
-2
@@ -366,10 +366,9 @@ void send_ep3_tournament_details(
|
||||
std::shared_ptr<const Episode3::Tournament> t);
|
||||
void send_ep3_game_details(
|
||||
std::shared_ptr<Client> c, std::shared_ptr<Lobby> l);
|
||||
|
||||
void send_ep3_update_spectator_count(std::shared_ptr<Lobby> l);
|
||||
|
||||
void send_ep3_card_auction(std::shared_ptr<ServerState> s, std::shared_ptr<Lobby> l);
|
||||
void send_ep3_disband_watcher_lobbies(std::shared_ptr<Lobby> primary_l);
|
||||
|
||||
// Pass mask_key = 0 to unmask the command
|
||||
void set_mask_for_ep3_game_command(void* vdata, size_t size, uint8_t mask_key);
|
||||
|
||||
+1
-8
@@ -250,14 +250,7 @@ void ServerState::remove_lobby(uint32_t lobby_id) {
|
||||
}
|
||||
l->watched_lobby.reset();
|
||||
} else {
|
||||
// Tell all players in all spectator teams to go back to the lobby
|
||||
for (auto watcher_l : l->watcher_lobbies) {
|
||||
if (!watcher_l->is_ep3()) {
|
||||
throw logic_error("spectator team is not an Episode 3 lobby");
|
||||
}
|
||||
l->log.info("Disbanding watcher lobby %" PRIX32, watcher_l->lobby_id);
|
||||
send_command(watcher_l, 0xED, 0x00);
|
||||
}
|
||||
send_ep3_disband_watcher_lobbies(l);
|
||||
}
|
||||
|
||||
l->log.info("Deleted lobby");
|
||||
|
||||
Reference in New Issue
Block a user