Judges can talk in games (#4091)

This commit is contained in:
Zach H
2020-09-09 13:20:59 -04:00
committed by GitHub
parent 79f590c99a
commit bec02b4952
4 changed files with 31 additions and 9 deletions

View File

@@ -919,8 +919,16 @@ Server_Player::cmdReadyStart(const Command_ReadyStart &cmd, ResponseContainer &
Response::ResponseCode
Server_Player::cmdGameSay(const Command_GameSay &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges)
{
if (spectator && !game->getSpectatorsCanTalk() && !(userInfo->user_level() & ServerInfo_User::IsModerator)) {
return Response::RespFunctionNotAllowed;
if (spectator) {
/* Spectators can only talk if:
* (a) the game creator allows it
* (b) the spectator is a moderator/administrator
* (c) the spectator is a judge
*/
bool isModOrJudge = (userInfo->user_level() & (ServerInfo_User::IsModerator | ServerInfo_User::IsJudge));
if (!isModOrJudge && !game->getSpectatorsCanTalk()) {
return Response::RespFunctionNotAllowed;
}
}
Event_GameSay event;