Use decimal instead of float in WVec.LerpQuadratic

To reduce desync risk (without introducing overflow risk).
This commit is contained in:
reaperrr
2016-03-24 15:11:00 +01:00
parent 73ec1ec9b2
commit fe23ac7f93

View File

@@ -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);
}