Skip to content

Commit

Permalink
Fix wrong first iteration in sv_fastpushmove 0 case
Browse files Browse the repository at this point in the history
  • Loading branch information
vsonnier committed Sep 10, 2024
1 parent d9c10a0 commit 3430a40
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Quake/sv_phys.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,19 +489,27 @@ static void SV_PushMove (edict_t *pusher, float movetime)

const bool fast_pushers = (sv_fastpushmove.value > 0.f);

int e = -1;

// beware, we skip entity 0:
check = NEXT_EDICT (qcvm->edicts);

int e = -1;

while (true)
{
// TBC :does qcvm->num_edicts always constant here, i.e is there edicts allocs possible in this loop ?
if (e >= (fast_pushers ? num_pushable_ent_cache - 1 : qcvm->num_edicts - 1 - 1))
break;

e++;
check = (fast_pushers ? pushable_ent_cache[e] : NEXT_EDICT (check));

if (fast_pushers)
{
check = pushable_ent_cache[e];
}
else if (e > 0)
{
check = NEXT_EDICT (check);
}

if (check->free)
continue;
Expand Down

0 comments on commit 3430a40

Please sign in to comment.