Commit MetaInfo

Revisione0396026bee90922aeff29c6cdfb1383cb447b78 (tree)
Time2021-05-01 21:56:12
AuthorAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Log Message

Fixed a regression with console messages not being printed to the RCON client.

Change Summary

Incremental Difference

diff -r ae4d29cd3c32 -r e0396026bee9 src/c_console.cpp
--- a/src/c_console.cpp Sat May 01 00:46:08 2021 -0400
+++ b/src/c_console.cpp Sat May 01 08:56:12 2021 -0400
@@ -243,7 +243,9 @@
243243
244244 // [BC] Is there a player executing a remote control command? If so, display messages that
245245 // are printed in the console as a result of his actions to him as well.
246+// [AK] Display a message to this player unless it was already printed to all players.
246247 static ULONG g_ulRCONPlayer = MAXPLAYERS;
248+static bool g_bPrintToRCONPlayer = true;
247249
248250 // [BC] Add a new print level for OpenGL messages.
249251 // [AK] Added a new print level for private chat messages.
@@ -717,6 +719,12 @@
717719 g_ulRCONPlayer = ulPlayer;
718720 }
719721
722+// [AK] Toggles whether or not a console message gets printed to the player using RCON.
723+void CONSOLE_ShouldPrintToRCONPlayer( bool enable )
724+{
725+ g_bPrintToRCONPlayer = enable;
726+}
727+
720728 static int FlushLines (const char *start, const char *stop)
721729 {
722730 int i;
@@ -1079,10 +1087,11 @@
10791087 // [RC] Send this to any connected RCON clients.
10801088 SERVER_RCON_Print( outlinecopy );
10811089 // [AK] We shouldn't broadcast the same message twice for the player who issued an RCON command.
1082- //if ( g_ulRCONPlayer != MAXPLAYERS )
1083- // SERVER_PrintfPlayer( printlevel, g_ulRCONPlayer, "%s", outlinecopy );
1090+ if (( g_ulRCONPlayer != MAXPLAYERS ) && ( g_bPrintToRCONPlayer ))
1091+ SERVER_PrintfPlayer( printlevel, g_ulRCONPlayer, "%s", outlinecopy );
10841092
10851093 SERVERCONSOLE_Print( outlinecopy );
1094+ g_bPrintToRCONPlayer = true;
10861095 }
10871096
10881097 const int length = static_cast<int>(strlen (outlinecopy));
diff -r ae4d29cd3c32 -r e0396026bee9 src/c_console.h
--- a/src/c_console.h Sat May 01 00:46:08 2021 -0400
+++ b/src/c_console.h Sat May 01 08:56:12 2021 -0400
@@ -75,6 +75,7 @@
7575
7676 // [BC] New function prototypes.
7777 void CONSOLE_SetRCONPlayer( ULONG ulPlayer );
78+void CONSOLE_ShouldPrintToRCONPlayer( bool enable ); // [AK]
7879
7980 void C_InitTicker (const char *label, unsigned int max, bool showpercent=true);
8081 void C_SetTicker (unsigned int at, bool forceUpdate=false);
diff -r ae4d29cd3c32 -r e0396026bee9 src/sv_main.cpp
--- a/src/sv_main.cpp Sat May 01 00:46:08 2021 -0400
+++ b/src/sv_main.cpp Sat May 01 08:56:12 2021 -0400
@@ -3092,6 +3092,9 @@
30923092 }
30933093 else
30943094 {
3095+ // [AK] Make sure we don't print the same message again to the RCON player.
3096+ CONSOLE_ShouldPrintToRCONPlayer( false );
3097+
30953098 // Print message locally in console window.
30963099 Printf( "%s", buffer );
30973100 }
Show on old repository browser