From: divverent Date: Sun, 20 Feb 2011 15:50:40 +0000 (+0000) Subject: CSQC entity networking: if a frame BEFORE the last packetlog reset got lost, this... X-Git-Tag: xonotic-v0.5.0~425^2~49 X-Git-Url: https://de.git.xonotic.org/?a=commitdiff_plain;h=f767b8d01c598b8920ff83eae09e3a3fb5dd25bf;p=xonotic%2Fdarkplaces.git CSQC entity networking: if a frame BEFORE the last packetlog reset got lost, this needs not trigger a new resend! git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10852 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/protocol.c b/protocol.c index 0c5984e2..d371f3fd 100644 --- a/protocol.c +++ b/protocol.c @@ -311,6 +311,11 @@ void EntityFrameCSQC_LostFrame(client_t *client, int framenum) static int recoversendflags[MAX_EDICTS]; csqcentityframedb_t *d; + if(client->csqcentityframe_lastreset < 0) + return; + if(framenum < client->csqcentityframe_lastreset) + return; // no action required, as we resent that data anyway + // is our frame out of history? ringfirst = client->csqcentityframehistory_next; // oldest entry ringlast = (ringfirst + NUM_CSQCENTITYDB_FRAMES - 1) % NUM_CSQCENTITYDB_FRAMES; // most recently added entry @@ -341,6 +346,7 @@ void EntityFrameCSQC_LostFrame(client_t *client, int framenum) Con_DPrintf("Lost frame = %d\n", framenum); Con_DPrintf("Entity DB = %d to %d\n", client->csqcentityframehistory[ringfirst].framenum, client->csqcentityframehistory[ringlast].framenum); EntityFrameCSQC_LostAllFrames(client); + client->csqcentityframe_lastreset = -1; } return; } @@ -446,6 +452,9 @@ qboolean EntityFrameCSQC_WriteFrame (sizebuf_t *msg, int maxsize, int numnumbers int dbframe = EntityFrameCSQC_AllocFrame(client, framenum); csqcentityframedb_t *db = &client->csqcentityframehistory[dbframe]; + if(client->csqcentityframe_lastreset < 0) + client->csqcentityframe_lastreset = framenum; + maxsize -= 24; // always fit in an empty svc_entities message (for packet loss detection!) // if this server progs is not CSQC-aware, return early diff --git a/server.h b/server.h index 030ffe7c..5df76bfb 100644 --- a/server.h +++ b/server.h @@ -251,6 +251,7 @@ typedef struct client_s unsigned char csqcentityglobalhistory[MAX_EDICTS]; // set to 1 if the entity was ever csqc networked to the client, and never reset back to 0 csqcentityframedb_t csqcentityframehistory[NUM_CSQCENTITYDB_FRAMES]; int csqcentityframehistory_next; + int csqcentityframe_lastreset; /// prevent animated names float nametime;