From 785ae892f473393d3d61074548fe958656f1da9d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 28 Nov 2016 22:47:50 +0900 Subject: [PATCH] Cast less. --- osu.Game.Mode.Osu/Objects/Slider.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game.Mode.Osu/Objects/Slider.cs b/osu.Game.Mode.Osu/Objects/Slider.cs index b06ae398f4..7ee131659a 100644 --- a/osu.Game.Mode.Osu/Objects/Slider.cs +++ b/osu.Game.Mode.Osu/Objects/Slider.cs @@ -54,10 +54,11 @@ namespace osu.Game.Modes.Osu.Objects progress = MathHelper.Clamp(progress, 0, 1); double index = progress * (calculatedPath.Count - 1); + int flooredIndex = (int)index; - Vector2 pos = calculatedPath[(int)index]; - if (index != (int)index) - pos += (calculatedPath[(int)index + 1] - pos) * (float)(index - (int)index); + Vector2 pos = calculatedPath[flooredIndex]; + if (index != flooredIndex) + pos += (calculatedPath[flooredIndex + 1] - pos) * (float)(index - flooredIndex); return pos; }