From d561e1461a5a2525250c065fec074e94eda429d8 Mon Sep 17 00:00:00 2001 From: havoc Date: Mon, 10 Jul 2006 07:35:06 +0000 Subject: [PATCH] changed how ping report hiding operates, so that it only hides one ping report for each ping command issued by the scoreboard git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6510 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_parse.c | 8 ++++++-- client.h | 6 ++++++ sbar.c | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/cl_parse.c b/cl_parse.c index 17efad5b..18b1e975 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -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; } } } diff --git a/client.h b/client.h index 4b85bcf2..ce30abb5 100644 --- 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 d9c3bba6..8d410fcd 100644 --- 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"); } -- 2.39.2