mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-05-30 16:50:48 +00:00
Solution for stufftext problem
This commit is contained in:
parent
02e48af08f
commit
6024c0ce7f
2 changed files with 26 additions and 8 deletions
|
@ -708,6 +708,8 @@ void PF_stuffcmd (void)
|
|||
int entnum;
|
||||
char *str;
|
||||
client_t *cl;
|
||||
char *buf;
|
||||
int i;
|
||||
|
||||
entnum = G_EDICTNUM(OFS_PARM0);
|
||||
if (entnum < 1 || entnum > MAX_CLIENTS)
|
||||
|
@ -716,14 +718,27 @@ void PF_stuffcmd (void)
|
|||
|
||||
cl = &svs.clients[entnum-1];
|
||||
|
||||
if (strcmp(str, "disconnect\n") == 0) {
|
||||
// so long and thanks for all the fish
|
||||
cl->drop = true;
|
||||
return;
|
||||
}
|
||||
buf = cl->stufftext_buf;
|
||||
if (strlen(buf) + strlen(str) >= MAX_STUFFTEXT)
|
||||
PR_RunError ("stufftext buffer overflow");
|
||||
strcat (buf, str);
|
||||
|
||||
ClientReliableWrite_Begin (cl, svc_stufftext, 2+strlen(str));
|
||||
ClientReliableWrite_String (cl, str);
|
||||
for (i = strlen(buf); i >= 0; i--)
|
||||
{
|
||||
if (buf[i] == '\n')
|
||||
{
|
||||
if (!strcmp(buf, "disconnect\n"))
|
||||
{
|
||||
// so long and thanks for all the fish
|
||||
cl->drop = true;
|
||||
buf[0] = 0;
|
||||
return;
|
||||
}
|
||||
ClientReliableWrite_Begin (cl, svc_stufftext, 2+strlen(buf));
|
||||
ClientReliableWrite_String (cl, buf);
|
||||
buf[0] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue