mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-29 23:22:01 +00:00
Makes Q2 with high visible entity counts more robust.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2184 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
39bc3f4ff9
commit
fa471eb239
1 changed files with 16 additions and 3 deletions
|
@ -292,6 +292,9 @@ void SVQ2_EmitPacketEntities (q2client_frame_t *from, q2client_frame_t *to, size
|
||||||
// in any bytes being emited if the entity has not changed at all
|
// in any bytes being emited if the entity has not changed at all
|
||||||
// note that players are always 'newentities', this updates their oldorigin always
|
// note that players are always 'newentities', this updates their oldorigin always
|
||||||
// and prevents warping
|
// and prevents warping
|
||||||
|
if (msg->cursize+128 > msg->maxsize)
|
||||||
|
memcpy(newent, oldent, sizeof(*newent)); //too much data, so set the ent up as the same as the old, so it's sent next frame
|
||||||
|
else
|
||||||
MSGQ2_WriteDeltaEntity (oldent, newent, msg, false, newent->number <= MAX_CLIENTS);
|
MSGQ2_WriteDeltaEntity (oldent, newent, msg, false, newent->number <= MAX_CLIENTS);
|
||||||
oldindex++;
|
oldindex++;
|
||||||
newindex++;
|
newindex++;
|
||||||
|
@ -300,8 +303,18 @@ void SVQ2_EmitPacketEntities (q2client_frame_t *from, q2client_frame_t *to, size
|
||||||
|
|
||||||
if (newnum < oldnum)
|
if (newnum < oldnum)
|
||||||
{ // this is a new entity, send it from the baseline
|
{ // this is a new entity, send it from the baseline
|
||||||
|
|
||||||
|
if (msg->cursize+128 > msg->maxsize)
|
||||||
|
{ //might cause the packet to overflow
|
||||||
|
//so strip out this ent, we can add it next frame if it's still relevent
|
||||||
|
to->num_entities--;
|
||||||
|
memmove(newent, newent+1, sizeof(*newent) * (to->num_entities-newindex));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
MSGQ2_WriteDeltaEntity (&sv_baselines[newnum], newent, msg, true, true);
|
MSGQ2_WriteDeltaEntity (&sv_baselines[newnum], newent, msg, true, true);
|
||||||
newindex++;
|
newindex++;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue