]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
CSQC entity networking: if a frame BEFORE the last packetlog reset got lost, this...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 20 Feb 2011 15:50:40 +0000 (15:50 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 20 Feb 2011 15:50:40 +0000 (15:50 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10852 d7cf8633-e32d-0410-b094-e92efae38249

protocol.c
server.h

index 0c5984e2de08da030b8952c1ca15db669605c71b..d371f3fd414c8e1416bda49e49c44b2749cab64e 100644 (file)
@@ -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
index 030ffe7c1893c6d305b64b257f8a4264fcb68d02..5df76bfbdf3e7383753cf9108cab07f1851d943f 100644 (file)
--- 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;