Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence certain spectator-related messages #3922

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading