Merge pull request #11821 from UnknownProgrammer/patch-1
Fix for System Overflow exception
This commit is contained in:
@@ -65,8 +65,10 @@ namespace OpenRA
|
||||
|
||||
// Add an additional quadratic variation to height
|
||||
// Uses decimal to avoid integer overflow
|
||||
var offset = (int)((decimal)(b - a).Length * pitch.Tan() * mul * (div - mul) / (1024 * div * div));
|
||||
return new WPos(ret.X, ret.Y, ret.Z + offset);
|
||||
var offset = (decimal)(b - a).Length * pitch.Tan() * mul * (div - mul) / (1024 * div * div);
|
||||
var clampedOffset = (int)(offset + (decimal)ret.Z).Clamp<decimal>((decimal)int.MinValue, (decimal)int.MaxValue);
|
||||
|
||||
return new WPos(ret.X, ret.Y, clampedOffset);
|
||||
}
|
||||
|
||||
public override int GetHashCode() { return X.GetHashCode() ^ Y.GetHashCode() ^ Z.GetHashCode(); }
|
||||
|
||||
Reference in New Issue
Block a user