From 3902c644247c5f71905a6ab77b399d81298160cf Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Sun, 8 Oct 2023 17:57:24 -0700 Subject: [PATCH] fix $spec in tournaments --- src/ChatCommands.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ChatCommands.cc b/src/ChatCommands.cc index e1c37443..c5c906a1 100644 --- a/src/ChatCommands.cc +++ b/src/ChatCommands.cc @@ -717,12 +717,18 @@ static void server_command_password(shared_ptr c, const std::u16string& static void server_command_toggle_spectator_flag(shared_ptr c, const std::u16string&) { auto l = c->require_lobby(); check_is_game(l, true); - check_is_leader(l, c); check_is_ep3(c, true); if (!l->is_ep3()) { throw logic_error("Episode 3 client in non-Episode 3 game"); } + // In non-tournament games, only the leader can do this; in a tournament + // match, the players don't have control over who the leader is, so we allow + // all players to use this command + if (!l->tournament_match) { + check_is_leader(l, c); + } + if (l->flags & Lobby::Flag::IS_SPECTATOR_TEAM) { send_text_message(c, u"$C6This command cannot\nbe used in a spectator\nteam"); }