From 3430a40991795679c4de92cf9bb1de1bf84fbc26 Mon Sep 17 00:00:00 2001 From: vsonnier Date: Tue, 10 Sep 2024 20:40:56 +0200 Subject: [PATCH] Fix wrong first iteration in sv_fastpushmove 0 case --- Quake/sv_phys.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Quake/sv_phys.c b/Quake/sv_phys.c index 46c54b66..0037cb3a 100644 --- a/Quake/sv_phys.c +++ b/Quake/sv_phys.c @@ -489,11 +489,11 @@ 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 ? @@ -501,7 +501,15 @@ static void SV_PushMove (edict_t *pusher, float movetime) 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;