]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_user.c
Fix a VERY LONG loop caused by high unreliable sequence numbers.
[xonotic/darkplaces.git] / sv_user.c
index a65705f49b59787e2bd263fb9ddd498c57156ab4..0cce2eb9d84129266dd4b48e5ffbafd4f787ee2f 100644 (file)
--- a/sv_user.c
+++ b/sv_user.c
@@ -59,7 +59,7 @@ void SV_SetIdealPitch (void)
                bottom[1] = top[1];
                bottom[2] = top[2] - 160;
 
-               tr = SV_TraceLine(top, bottom, MOVE_NOMONSTERS, host_client->edict, SUPERCONTENTS_SOLID);
+               tr = SV_TraceLine(top, bottom, MOVE_NOMONSTERS, host_client->edict, SUPERCONTENTS_SOLID, collision_extendmovelength.value);
                // if looking at a wall, leave ideal the way is was
                if (tr.startsolid)
                        return;
@@ -126,7 +126,7 @@ static void SV_UserFriction (void)
        start[2] = PRVM_serveredictvector(host_client->edict, origin)[2] + PRVM_serveredictvector(host_client->edict, mins)[2];
        stop[2] = start[2] - 34;
 
-       trace = SV_TraceLine(start, stop, MOVE_NOMONSTERS, host_client->edict, SV_GenericHitSuperContentsMask(host_client->edict));
+       trace = SV_TraceLine(start, stop, MOVE_NOMONSTERS, host_client->edict, SV_GenericHitSuperContentsMask(host_client->edict), collision_extendmovelength.value);
 
        if (trace.fraction == 1.0)
                friction = sv_friction.value*sv_edgefriction.value;
@@ -764,13 +764,18 @@ void SV_ApplyClientMove (void)
        PRVM_serveredictfloat(host_client->edict, ping_movementloss) = movementloss / (float) NETGRAPH_PACKETS;
 }
 
-static void SV_FrameLost(int framenum)
+static qboolean SV_FrameLost(int framenum)
 {
        if (host_client->entitydatabase5)
        {
-               EntityFrame5_LostFrame(host_client->entitydatabase5, framenum);
-               EntityFrameCSQC_LostFrame(host_client, framenum);
+               if (framenum <= host_client->entitydatabase5->latestframenum)
+               {
+                       EntityFrame5_LostFrame(host_client->entitydatabase5, framenum);
+                       EntityFrameCSQC_LostFrame(host_client, framenum);
+                       return true;
+               }
        }
+       return false;
 }
 
 static void SV_FrameAck(int framenum)
@@ -878,7 +883,7 @@ void SV_ReadClientMessage(void)
 clc_stringcmd_invalid:
                        Con_Printf("Received invalid stringcmd from %s\n", host_client->name);
                        if(developer.integer > 0)
-                               Com_HexDumpToConsole((unsigned char *) s, strlen(s));
+                               Com_HexDumpToConsole((unsigned char *) s, (int)strlen(s));
                        break;
 
                case clc_disconnect:
@@ -954,7 +959,8 @@ clc_stringcmd_invalid:
                        {
                                int i;
                                for (i = host_client->latestframenum + 1;i < num;i++)
-                                       SV_FrameLost(i);
+                                       if (!SV_FrameLost(i))
+                                               break;
                                SV_FrameAck(num);
                                host_client->latestframenum = num;
                        }