From ea3c2f0d78f29feaaa4951cfe26eab60f9a40085 Mon Sep 17 00:00:00 2001 From: Brian Koropoff Date: Fri, 19 Apr 2002 06:26:08 +0000 Subject: [PATCH] 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. --- qw/source/cl_parse.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/qw/source/cl_parse.c b/qw/source/cl_parse.c index f923681c5..321eeaa7e 100644 --- a/qw/source/cl_parse.c +++ b/qw/source/cl_parse.c @@ -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: