From 12d2b3a8dc431b57364f19edd060438180d6dcd2 Mon Sep 17 00:00:00 2001 From: havoc Date: Sun, 12 Apr 2009 10:06:31 +0000 Subject: [PATCH] don't allocate packetlog entries if there is nothing to put in them - fixes packetlog overflow messages when paused git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8910 d7cf8633-e32d-0410-b094-e92efae38249 --- protocol.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/protocol.c b/protocol.c index 3bbaa445..748e23b3 100644 --- a/protocol.c +++ b/protocol.c @@ -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); -- 2.39.2