Changed stufftext behavior so that commands are built up until a \n is

found at the end of the string.  This works around a stupidity in some
servers where stufftext commands are sent in pieces and might not reach
the client before execution occurs, resulting in parse errors.
This commit is contained in:
Brian Koropoff 2002-04-19 06:26:08 +00:00
parent e34ab5541c
commit ea3c2f0d78

View file

@ -54,6 +54,7 @@ static const char rcsid[] =
#include "QF/teamplay.h"
#include "QF/va.h"
#include "QF/vfile.h"
#include "QF/dstring.h"
#include "bothdefs.h"
#include "cl_ents.h"
@ -1128,6 +1129,7 @@ void
CL_ParseServerMessage (void)
{
const char *s;
static dstring_t *stuffbuf;
int cmd, i, j;
received_framecount = host_framecount;
@ -1208,9 +1210,15 @@ CL_ParseServerMessage (void)
break;
case svc_stufftext:
if (!stuffbuf) stuffbuf = dstring_newstr();
s = MSG_ReadString (net_message);
Con_DPrintf ("stufftext: %s\n", s);
Cbuf_AddTextTo (cmd_legacybuffer, s);
Con_DPrintf ("partial stufftext: %s\n", s);
dstring_appendstr (stuffbuf, s);
if (stuffbuf->str[strlen(stuffbuf->str)-1] == '\n') {
Con_DPrintf ("stufftext: %s\n", stuffbuf->str);
Cbuf_AddTextTo (cmd_legacybuffer, stuffbuf->str);
dstring_clearstr (stuffbuf);
}
break;
case svc_damage: