From 76c8c8806e3a3e58f6a5f6319925b36ffe39500c Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Tue, 22 Oct 2013 22:22:09 +1300 Subject: [PATCH] Remove desyncing fp from WPos.LerpQuadratic. Fixes #3966. --- OpenRA.FileFormats/WPos.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenRA.FileFormats/WPos.cs b/OpenRA.FileFormats/WPos.cs index 7ccc4d22f2..589b3c003a 100644 --- a/OpenRA.FileFormats/WPos.cs +++ b/OpenRA.FileFormats/WPos.cs @@ -47,8 +47,8 @@ namespace OpenRA return ret; // Add an additional quadratic variation to height - // Uses fp to avoid integer overflow - var offset = (int)((float)((float)(b - a).Length*pitch.Tan()*mul*(div - mul)) / (float)(1024*div*div)); + // Attempts to avoid integer overflow by keeping the intermediate variables reasonably sized + var offset = (int)(((((((long)(b - a).Length * mul) / div) * (div - mul)) / div) * pitch.Tan()) / 1024); return new WPos(ret.X, ret.Y, ret.Z + offset); }