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
This commit is contained in:
ewasylishen 2017-04-25 20:07:34 +00:00
parent 95fca75a77
commit eb2701a484
2 changed files with 8 additions and 1 deletions

View file

@ -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

View file

@ -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;
}