From d5584c06450f30a3ee99f234b5904959d2430d18 Mon Sep 17 00:00:00 2001 From: IbanPlay <56191483+IbanPlay@users.noreply.github.com> Date: Wed, 5 Jan 2022 05:03:51 +0100 Subject: [PATCH] Fixed a silly problem --- Utilities/MathematicalUtils.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Utilities/MathematicalUtils.cs b/Utilities/MathematicalUtils.cs index 6469e1a4d5..46082a6313 100644 --- a/Utilities/MathematicalUtils.cs +++ b/Utilities/MathematicalUtils.cs @@ -208,11 +208,15 @@ namespace CalamityMod float startPoint = segment.originX; float endPoint = 1f; - if (progress < segment.originX) //Too early + if (progress < segment.originX) //Too early. This should never get reached, since by the time you'd have gotten there you'd have found the appropriate segment and broken out of the for loop continue; if (i < segments.Length - 1) + { + if (segments[i + 1].originX <= progress) //Too late + continue; endPoint = segments[i + 1].originX; + } float segmentLenght = endPoint - startPoint; float segmentProgress = (progress - segment.originX) / segmentLenght; //How far along the specific segment