| 794 | } |
| 795 | |
| 796 | void CGameContext::SendModeratorAlert(const char *pMessage, int ToClientId) |
| 797 | { |
| 798 | dbg_assert(in_range(ToClientId, 0, MAX_CLIENTS - 1), "SendImportantAlert ToClientId invalid: %d", ToClientId); |
| 799 | dbg_assert(m_apPlayers[ToClientId] != nullptr, "Client not online: %d", ToClientId); |
| 800 | |
| 801 | if(m_apPlayers[ToClientId]->GetClientVersion() >= VERSION_DDNET_IMPORTANT_ALERT) |
| 802 | { |
| 803 | CNetMsg_Sv_ModeratorAlert Msg; |
| 804 | Msg.m_pMessage = pMessage; |
| 805 | Server()->SendPackMsg(&Msg, MSGFLAG_VITAL | MSGFLAG_NORECORD, ToClientId); |
| 806 | } |
| 807 | else |
| 808 | { |
| 809 | char aBroadcastText[1024 + 32]; |
| 810 | str_copy(aBroadcastText, "MODERATOR ALERT\n\n"); |
| 811 | str_append(aBroadcastText, pMessage); |
| 812 | SendBroadcast(aBroadcastText, ToClientId, true); |
| 813 | log_info("moderator_alert", "Notice: player uses an old client version and may not see moderator alerts: %s (ID %d)", Server()->ClientName(ToClientId), ToClientId); |
| 814 | } |
| 815 | } |
| 816 | |
| 817 | void CGameContext::SendBroadcast(const char *pText, int ClientId, bool IsImportant) |
| 818 | { |
no test coverage detected