From eb2701a484bba84ef63ba2abb8fc8f86449583bc Mon Sep 17 00:00:00 2001 From: ewasylishen Date: Tue, 25 Apr 2017 20:07:34 +0000 Subject: [PATCH] PF_VarString: throttle "exceeds standard limit" warning message Prevents console spam on "developer 1" if a mod calls PF_VarString often (e.g. In the Shadows textbooks). git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@1402 af15c1b1-3010-417e-b628-4374ebc0bcbd --- quakespasm/Quake/glquake.h | 1 + quakespasm/Quake/pr_cmds.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/quakespasm/Quake/glquake.h b/quakespasm/Quake/glquake.h index ff61cb11..e85dfb6b 100644 --- a/quakespasm/Quake/glquake.h +++ b/quakespasm/Quake/glquake.h @@ -284,6 +284,7 @@ typedef struct { double packetsize; double efrags; double beams; + double varstring; } overflowtimes_t; extern overflowtimes_t dev_overflows; //this stores the last time overflow messages were displayed, not the last time overflows occured #define CONSOLE_RESPAM_TIME 3 // seconds between repeated warning messages diff --git a/quakespasm/Quake/pr_cmds.c b/quakespasm/Quake/pr_cmds.c index ff886623..f650dcea 100644 --- a/quakespasm/Quake/pr_cmds.c +++ b/quakespasm/Quake/pr_cmds.c @@ -65,7 +65,13 @@ static char *PF_VarString (int first) } } if (s > 255) - Con_DWarning("PF_VarString: %i characters exceeds standard limit of 255 (max = %d).\n", (int) s, (int)(sizeof(out) - 1)); + { + if (!dev_overflows.varstring || dev_overflows.varstring + CONSOLE_RESPAM_TIME < realtime) + { + Con_DWarning("PF_VarString: %i characters exceeds standard limit of 255 (max = %d).\n", (int) s, (int)(sizeof(out) - 1)); + dev_overflows.varstring = realtime; + } + } return out; }