]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
com_ents4: Fix possible logic bug with two for loops
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 17 Sep 2020 12:36:53 +0000 (12:36 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 17 Sep 2020 12:36:53 +0000 (12:36 +0000)
This is very likely what was originally intended as the second loop
would be resetting i, which the first loop is already iterating...

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

com_ents4.c

index f415f68c627460aa394c77c7fe052591f802b202..67bfba093df88e302b89522309c40102d371e455 100644 (file)
@@ -80,12 +80,10 @@ int EntityFrame4_AckFrame(entityframe4_database_t *d, int framenum, int servermo
                // reset reference, but leave commits alone
                d->referenceframenum = -1;
                for (i = 0;i < d->maxreferenceentities;i++)
-               {
                        d->referenceentity[i] = defaultstate;
                // if this is the server, remove commits
-                       for (i = 0, commit = d->commit;i < MAX_ENTITY_HISTORY;i++, commit++)
-                               commit->numentities = 0;
-               }
+               for (i = 0, commit = d->commit;i < MAX_ENTITY_HISTORY;i++, commit++)
+                       commit->numentities = 0;
                found = true;
        }
        else if (d->referenceframenum == framenum)