From fe23ac7f93b6ccc0eb5d63f32c935db81f106db7 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Thu, 24 Mar 2016 15:11:00 +0100 Subject: [PATCH] Use decimal instead of float in WVec.LerpQuadratic To reduce desync risk (without introducing overflow risk). --- OpenRA.Game/WVec.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenRA.Game/WVec.cs b/OpenRA.Game/WVec.cs index bfce594265..068845bf37 100644 --- a/OpenRA.Game/WVec.cs +++ b/OpenRA.Game/WVec.cs @@ -82,8 +82,8 @@ namespace OpenRA return ret; // Add an additional quadratic variation to height - // Uses fp to avoid integer overflow - var offset = (int)((float)(b - a).Length * pitch.Tan() * mul * (div - mul) / (1024 * div * div)); + // Uses decimal to avoid integer overflow + var offset = (int)((decimal)(b - a).Length * pitch.Tan() * mul * (div - mul) / (1024 * div * div)); return new WVec(ret.X, ret.Y, ret.Z + offset); }