changed how ping report hiding operates, so that it only hides one ping report for...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 10 Jul 2006 07:35:06 +0000 (07:35 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 10 Jul 2006 07:35:06 +0000 (07:35 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6510 d7cf8633-e32d-0410-b094-e92efae38249

cl_parse.c
client.h
sbar.c

index 17efad5..18b1e97 100644 (file)
@@ -2051,10 +2051,11 @@ qboolean CL_ExaminePrintString(const char *text)
        {
                cl.parsingtextmode = CL_PARSETEXTMODE_PING;
                cl.parsingtextplayerindex = 0;
-               return !sb_showscores;
+               return !cl.parsingtextexpectingpingforscores;
        }
        if (!strncmp(text, "host:    ", 9))
        {
+               cl.parsingtextexpectingpingforscores = false;
                cl.parsingtextmode = CL_PARSETEXTMODE_STATUS;
                cl.parsingtextplayerindex = 0;
                return true;
@@ -2062,6 +2063,8 @@ qboolean CL_ExaminePrintString(const char *text)
        if (cl.parsingtextmode == CL_PARSETEXTMODE_PING)
        {
                // if anything goes wrong, we'll assume this is not a ping report
+               qboolean expected = cl.parsingtextexpectingpingforscores;
+               cl.parsingtextexpectingpingforscores = false;
                cl.parsingtextmode = CL_PARSETEXTMODE_NONE;
                t = text;
                while (*t == ' ')
@@ -2086,8 +2089,9 @@ qboolean CL_ExaminePrintString(const char *text)
                                        {
                                                // we parsed a valid ping entry, so expect another to follow
                                                cl.parsingtextmode = CL_PARSETEXTMODE_PING;
+                                               cl.parsingtextexpectingpingforscores = expected;
                                        }
-                                       return !sb_showscores;
+                                       return !expected;
                                }
                        }
                }
index 4b85bcf..ce30abb 100644 (file)
--- a/client.h
+++ b/client.h
@@ -786,6 +786,12 @@ typedef struct client_state_s
        // keep track of svc_print parsing state (analyzes ping reports and status reports)
        cl_parsingtextmode_t parsingtextmode;
        int parsingtextplayerindex;
+       // set by scoreboard code when sending ping command, this causes the next ping results to be hidden
+       // (which could eat the wrong ping report if the player issues one
+       //  manually, but they would still see a ping report, just a later one
+       //  caused by the scoreboard code rather than the one they intentionally
+       //  issued)
+       qboolean parsingtextexpectingpingforscores;
 
        // entity database stuff
        // latest received entity frame numbers
diff --git a/sbar.c b/sbar.c
index d9c3bba..8d410fc 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -1411,6 +1411,7 @@ void Sbar_DeathmatchOverlay (void)
                else if (cls.protocol == PROTOCOL_QUAKE || cls.protocol == PROTOCOL_QUAKEDP || cls.protocol == PROTOCOL_NEHAHRAMOVIE || cls.protocol == PROTOCOL_DARKPLACES1 || cls.protocol == PROTOCOL_DARKPLACES2 || cls.protocol == PROTOCOL_DARKPLACES3 || cls.protocol == PROTOCOL_DARKPLACES4 || cls.protocol == PROTOCOL_DARKPLACES5 || cls.protocol == PROTOCOL_DARKPLACES6 || cls.protocol == PROTOCOL_DARKPLACES7)
                {
                        // these servers usually lack the pings command and so a less efficient "ping" command must be sent, which on modern DP servers will also reply with a pingplreport command after the ping listing
+                       cl.parsingtextexpectingpingforscores = true; // hide the output of the next ping report
                        MSG_WriteByte(&cls.netcon->message, clc_stringcmd);
                        MSG_WriteString(&cls.netcon->message, "ping");
                }