From f0aea54e5d221956699a489330175f5eb8a2380d Mon Sep 17 00:00:00 2001 From: Spoike Date: Sat, 14 Aug 2021 04:04:15 +0000 Subject: [PATCH] Make sure backbuf net primitives don't get corrupted. This is presumably what was causing the wrongly-sized angles / illegible server message issues that fortressone was having. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6020 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/server/sv_init.c | 3 ++- engine/server/sv_main.c | 6 ++++-- engine/server/sv_nchan.c | 2 ++ engine/server/sv_send.c | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/engine/server/sv_init.c b/engine/server/sv_init.c index b8a5ec87b..efced3db6 100644 --- a/engine/server/sv_init.c +++ b/engine/server/sv_init.c @@ -748,7 +748,8 @@ void SV_SetupNetworkBuffers(qboolean bigcoords) //make sure those are kept up to date too. svs.clients[i].datagram.prim = - svs.clients[i].netchan.message.prim = svs.clients[i].netchan.netprim; + svs.clients[i].netchan.message.prim = + svs.clients[i].backbuf.prim = svs.clients[i].netchan.netprim; } // diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index a26b0040d..1eeafefa6 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -2362,6 +2362,7 @@ client_t *SV_AddSplit(client_t *controller, char *info, int id) cl->spectator = asspec; cl->netchan.remote_address = controller->netchan.remote_address; cl->netchan.message.prim = controller->netchan.message.prim; + cl->backbuf.prim = controller->backbuf.prim; cl->netchan.netprim = controller->netchan.netprim; cl->zquake_extensions = controller->zquake_extensions; cl->fteprotocolextensions = controller->fteprotocolextensions; @@ -2968,8 +2969,9 @@ void SV_DoDirectConnect(svconnectinfo_t *fte_restrict info) else newcl->datagram.maxsize = MAX_DATAGRAM; - newcl->netchan.netprim = svs.netprim; - newcl->datagram.prim = svs.netprim; + newcl->netchan.netprim = + newcl->datagram.prim = + newcl->backbuf.prim = newcl->netchan.message.prim = svs.netprim; SV_ClientProtocolExtensionsChanged(newcl); diff --git a/engine/server/sv_nchan.c b/engine/server/sv_nchan.c index cb15153bf..437652b64 100644 --- a/engine/server/sv_nchan.c +++ b/engine/server/sv_nchan.c @@ -33,6 +33,7 @@ void ClientReliableCheckBlock(client_t *cl, int maxsize) if (!cl->num_backbuf) { memset(&cl->backbuf, 0, sizeof(cl->backbuf)); + cl->backbuf.prim = cl->netchan.message.prim; cl->backbuf.allowoverflow = true; cl->backbuf.data = cl->backbuf_data[0]; cl->backbuf.maxsize = min(cl->netchan.message.maxsize, sizeof(cl->backbuf_data[0])); @@ -52,6 +53,7 @@ void ClientReliableCheckBlock(client_t *cl, int maxsize) return; } memset(&cl->backbuf, 0, sizeof(cl->backbuf)); + cl->backbuf.prim = cl->netchan.message.prim; cl->backbuf.allowoverflow = true; cl->backbuf.data = cl->backbuf_data[cl->num_backbuf]; cl->backbuf.maxsize = min(cl->netchan.message.maxsize, sizeof(cl->backbuf_data[cl->num_backbuf])); diff --git a/engine/server/sv_send.c b/engine/server/sv_send.c index 30c3feb63..1fd21a38d 100644 --- a/engine/server/sv_send.c +++ b/engine/server/sv_send.c @@ -3607,6 +3607,7 @@ void SV_SendClientMessages (void) if (c->num_backbuf) { memset(&c->backbuf, 0, sizeof(c->backbuf)); + c->backbuf.prim = c->netchan.message.prim; c->backbuf.data = c->backbuf_data[c->num_backbuf - 1]; c->backbuf.cursize = c->backbuf_size[c->num_backbuf - 1]; c->backbuf.maxsize = min(c->netchan.message.maxsize, sizeof(c->backbuf_data[c->num_backbuf-1]));