]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
don't allocate packetlog entries if there is nothing to put in them -
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 12 Apr 2009 10:06:31 +0000 (10:06 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 12 Apr 2009 10:06:31 +0000 (10:06 +0000)
fixes packetlog overflow messages when paused

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8910 d7cf8633-e32d-0410-b094-e92efae38249

protocol.c

index 3bbaa44552c817188429e448344e73def24987db..748e23b341afce3775aa5456fb5dadfe85f9ca4f 100644 (file)
@@ -2604,10 +2604,7 @@ void EntityFrame5_WriteFrame(sizebuf_t *msg, int maxsize, entityframe5_database_
                }
        }
 
-       // add packetlog entry
-       packetlog = d->packetlog + packetlognumber;
-       packetlog->packetnumber = framenum;
-       packetlog->numstates = 0;
+       packetlog = NULL;
        // write stat updates
        if (sv.protocol != PROTOCOL_QUAKE && sv.protocol != PROTOCOL_QUAKEDP && sv.protocol != PROTOCOL_NEHAHRAMOVIE && sv.protocol != PROTOCOL_NEHAHRABJP && sv.protocol != PROTOCOL_NEHAHRABJP2 && sv.protocol != PROTOCOL_NEHAHRABJP3 && sv.protocol != PROTOCOL_DARKPLACES1 && sv.protocol != PROTOCOL_DARKPLACES2 && sv.protocol != PROTOCOL_DARKPLACES3 && sv.protocol != PROTOCOL_DARKPLACES4 && sv.protocol != PROTOCOL_DARKPLACES5)
        {
@@ -2616,6 +2613,13 @@ void EntityFrame5_WriteFrame(sizebuf_t *msg, int maxsize, entityframe5_database_
                        if (host_client->statsdeltabits[i>>3] & (1<<(i&7)))
                        {
                                host_client->statsdeltabits[i>>3] &= ~(1<<(i&7));
+                               // add packetlog entry now that we have something for it
+                               if (!packetlog)
+                               {
+                                       packetlog = d->packetlog + packetlognumber;
+                                       packetlog->packetnumber = framenum;
+                                       packetlog->numstates = 0;
+                               }
                                packetlog->statsdeltabits[i>>3] |= (1<<(i&7));
                                if (host_client->stats[i] >= 0 && host_client->stats[i] < 256)
                                {
@@ -2639,6 +2643,14 @@ void EntityFrame5_WriteFrame(sizebuf_t *msg, int maxsize, entityframe5_database_
        if(!l && !need_empty)
                return;
 
+       // add packetlog entry now that we have something for it
+       if (!packetlog)
+       {
+               packetlog = d->packetlog + packetlognumber;
+               packetlog->packetnumber = framenum;
+               packetlog->numstates = 0;
+       }
+
        // write state updates
        if (developer_networkentities.integer >= 10)
                Con_Printf("send: svc_entities %i\n", framenum);