rearrange the svc_stufftext code so stuffbuff doesn't even get allocated if

it's not needed. This should speed things up fractionally for well behaved
mods/servers that send atomic svc_stufftext packets (ie, always ending in
\n).
This commit is contained in:
Bill Currie 2002-04-19 17:58:52 +00:00
parent ea3c2f0d78
commit 97029c0689

View file

@ -1210,14 +1210,21 @@ CL_ParseServerMessage (void)
break;
case svc_stufftext:
if (!stuffbuf) stuffbuf = dstring_newstr();
s = MSG_ReadString (net_message);
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);
if (s[strlen (s) - 1] == '\n') {
if (stuffbuf && stuffbuf->str[0]) {
Con_DPrintf ("stufftext: %s%s\n", stuffbuf->str, s);
Cbuf_AddTextTo (cmd_legacybuffer, stuffbuf->str);
dstring_clearstr (stuffbuf);
} else {
Con_DPrintf ("stufftext: %s\n", s);
}
Cbuf_AddTextTo (cmd_legacybuffer, s);
} else {
Con_DPrintf ("partial stufftext: %s\n", s);
if (!stuffbuf)
stuffbuf = dstring_newstr();
dstring_appendstr (stuffbuf, s);
}
break;