Skip to content

Commit

Permalink
Silence certain spectator-related messages
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Jun 26, 2024
1 parent 4aa7547 commit 3d3175d
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/multiplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,12 +393,15 @@ bool multiPlayerLoop()
{
if (ingame.DataIntegrity[index] == false && isHumanPlayer(index) && index != NetPlay.hostPlayer)
{
char msg[256] = {'\0'};
if (!ingame.PendingDisconnect[index])
{
char msg[256] = {'\0'};

snprintf(msg, sizeof(msg), _("Kicking player %s, because they tried to bypass data integrity check!"), getPlayerName(index));
sendInGameSystemMessage(msg);
addConsoleMessage(msg, LEFT_JUSTIFY, NOTIFY_MESSAGE);
NETlogEntry(msg, SYNC_FLAG, index);
snprintf(msg, sizeof(msg), _("Kicking player %s, because they tried to bypass data integrity check!"), getPlayerName(index));
sendInGameSystemMessage(msg);
addConsoleMessage(msg, LEFT_JUSTIFY, NOTIFY_MESSAGE);
NETlogEntry(msg, SYNC_FLAG, index);
}

#ifndef DEBUG
kickPlayer(index, _("Invalid data!"), ERROR_INVALID, false);
Expand Down Expand Up @@ -822,9 +825,12 @@ static bool sendDataCheck2()
&& (std::chrono::duration_cast<std::chrono::seconds>(now - ingame.lastSentPlayerDataCheck2[player].value()) >= maxWaitSeconds))
{
// If it's after the allowed time, kick the player
std::string msg = astringf(_("%s (%u) has an incompatible mod, and has been kicked."), getPlayerName(player), player);
sendInGameSystemMessage(msg.c_str());
addConsoleMessage(msg.c_str(), LEFT_JUSTIFY, NOTIFY_MESSAGE);
if (!ingame.PendingDisconnect[player])
{
std::string msg = astringf(_("%s (%u) has an incompatible mod, and has been kicked."), getPlayerName(player), player);
sendInGameSystemMessage(msg.c_str());
addConsoleMessage(msg.c_str(), LEFT_JUSTIFY, NOTIFY_MESSAGE);
}

kickPlayer(player, _("Your data doesn't match the host's!"), ERROR_WRONGDATA, false);
debug(LOG_INFO, "%s (%u) did not respond with a NET_DATA_CHECK2 within the required timeframe (%s seconds), and has been kicked", getPlayerName(player), player, std::to_string(maxWaitSeconds.count()).c_str());
Expand Down

0 comments on commit 3d3175d

Please sign in to comment.