]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - protocol.c
we need one more glsl 130 compat ifdef...
[xonotic/darkplaces.git] / protocol.c
index f6975f226eb2b91ca0a6a143c13ff3214e63c33b..d371f3fd414c8e1416bda49e49c44b2749cab64e 100644 (file)
@@ -112,7 +112,7 @@ int Protocol_NumberForEnum(protocolversion_t p)
        int i;
        for (i = 0;protocolversioninfo[i].name;i++)
                if (protocolversioninfo[i].version == p)
-                       return protocolversioninfo[p].number;
+                       return protocolversioninfo[i].number;
        return 0;
 }
 
@@ -305,13 +305,16 @@ static void EntityFrameCSQC_LostAllFrames(client_t *client)
 void EntityFrameCSQC_LostFrame(client_t *client, int framenum)
 {
        // marks a frame as lost
-       int i, j, n;
+       int i, j;
        qboolean valid;
        int ringfirst, ringlast;
        static int recoversendflags[MAX_EDICTS];
        csqcentityframedb_t *d;
 
-       n = client->csqcnumedicts;
+       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
@@ -343,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;
        }
@@ -448,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
@@ -2036,7 +2043,7 @@ static void EntityFrame5_ExpandEdicts(entityframe5_database_t *d, int newmax)
 static int EntityState5_Priority(entityframe5_database_t *d, int stateindex)
 {
        int limit, priority;
-       entity_state_t *s;
+       entity_state_t *s = NULL; // hush compiler warning by initializing this
        // if it is the player, update urgently
        if (stateindex == d->viewentnum)
                return ENTITYFRAME5_PRIORITYLEVELS - 1;
@@ -2868,10 +2875,10 @@ void EntityStateQW_ReadPlayerUpdate(void)
                if (bits & QW_CM_UP)
                        MSG_ReadShort(); // cmd->upmove
                if (bits & QW_CM_BUTTONS)
-                       MSG_ReadByte(); // cmd->buttons
+                       (void) MSG_ReadByte(); // cmd->buttons
                if (bits & QW_CM_IMPULSE)
-                       MSG_ReadByte(); // cmd->impulse
-               MSG_ReadByte(); // cmd->msec
+                       (void) MSG_ReadByte(); // cmd->impulse
+               (void) MSG_ReadByte(); // cmd->msec
        }
        if (playerflags & QW_PF_VELOCITY1)
                velocity[0] = MSG_ReadShort();