From a55b21339379411dcfd16235cc5ec898e86e4c6c Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Mon, 20 Mar 2023 21:12:33 -0700 Subject: [PATCH] fix: Fixes fastwalk (#1377) --- Projects/Server/Network/NetState/NetState.Fastwalk.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Projects/Server/Network/NetState/NetState.Fastwalk.cs b/Projects/Server/Network/NetState/NetState.Fastwalk.cs index a886985f2..ec05338e3 100644 --- a/Projects/Server/Network/NetState/NetState.Fastwalk.cs +++ b/Projects/Server/Network/NetState/NetState.Fastwalk.cs @@ -39,17 +39,21 @@ public partial class NetState var now = Core.TickCount; + var lastIndex = -1; + // Expire old steps while (_expiredIndex != _stepIndex) { var step = _steps[_expiredIndex]; // Is the step ahead of us, or the next step rolled over and we didn't yet - if (step - now > 0) + if (step - now > 0 || lastIndex > -1 && _steps[lastIndex] > step) { break; } + lastIndex = _expiredIndex++; + if (_expiredIndex == stepsLength) { _expiredIndex -= stepsLength;