]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
another patch from div0 to improve ping parsing behavior in the event that multiple...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 29 Aug 2006 12:58:45 +0000 (12:58 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 29 Aug 2006 12:58:45 +0000 (12:58 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6576 d7cf8633-e32d-0410-b094-e92efae38249

cl_main.c
cl_parse.c
client.h
sbar.c

index fae786c0961be200117452147a9a1e74cdd18181..f4f09c34cfe133527a437d3ec54e66ac8e1f5d2b 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -324,6 +324,8 @@ void CL_Disconnect(void)
 // stop sounds (especially looping!)
        S_StopAllSounds ();
 
+       cl.parsingtextexpectingpingforscores = 0; // just in case no reply has come yet
+
        // clear contents blends
        cl.cshifts[0].percent = 0;
        cl.cshifts[1].percent = 0;
index 7eaaaaef9c14bc4d41aac2e6a244211b3c3bdd38..bbe2483e76c36467a04d192427ad44dc048e98ec 100644 (file)
@@ -2058,13 +2058,14 @@ qboolean CL_ExaminePrintString(const char *text)
                {
                        Con_Printf("ping reply but empty scoreboard?!?\n");
                        cl.parsingtextmode = CL_PARSETEXTMODE_NONE;
-                       cl.parsingtextexpectingpingforscores = false;
+                       cl.parsingtextexpectingpingforscores = 0;
                }
+               cl.parsingtextexpectingpingforscores = cl.parsingtextexpectingpingforscores ? 2 : 0;
                return !cl.parsingtextexpectingpingforscores;
        }
        if (!strncmp(text, "host:    ", 9))
        {
-               cl.parsingtextexpectingpingforscores = false;
+               // cl.parsingtextexpectingpingforscores = false; // really?
                cl.parsingtextmode = CL_PARSETEXTMODE_STATUS;
                cl.parsingtextplayerindex = 0;
                return true;
@@ -2073,7 +2074,7 @@ qboolean CL_ExaminePrintString(const char *text)
        {
                // if anything goes wrong, we'll assume this is not a ping report
                qboolean expected = cl.parsingtextexpectingpingforscores;
-               cl.parsingtextexpectingpingforscores = false;
+               cl.parsingtextexpectingpingforscores = 0;
                cl.parsingtextmode = CL_PARSETEXTMODE_NONE;
                t = text;
                while (*t == ' ')
index 0bd5eb90690c48a2da3ce946569dba2664d967f2..ea80fec1bdf9ac51a02c4ef6e138a4af5014309e 100644 (file)
--- a/client.h
+++ b/client.h
@@ -793,7 +793,7 @@ typedef struct client_state_s
        //  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;
+       int parsingtextexpectingpingforscores;
 
        // entity database stuff
        // latest received entity frame numbers
diff --git a/sbar.c b/sbar.c
index 81b5d85b2bb276f0a50a1615893d94935e5ce35d..809c6044a0b24762fe97d953150e0396003f8aa8 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -1462,9 +1462,20 @@ 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");
+                       static int ping_anyway_counter = 0;
+                       if(cl.parsingtextexpectingpingforscores == 1)
+                       {
+                               Con_DPrintf("want to send ping, but still waiting for other reply\n");
+                               if(++ping_anyway_counter >= 5)
+                                       cl.parsingtextexpectingpingforscores = 0;
+                       }
+                       if(cl.parsingtextexpectingpingforscores != 1)
+                       {
+                               ping_anyway_counter = 0;
+                               cl.parsingtextexpectingpingforscores = 1; // hide the output of the next ping report
+                               MSG_WriteByte(&cls.netcon->message, clc_stringcmd);
+                               MSG_WriteString(&cls.netcon->message, "ping");
+                       }
                }
                else
                {