Fix Rectangle OuterRadius

Rectangle shapes always assumed that either top-left or bottom-right would have the largest distance from actor center, which is wrong, because depending on the position of the shape, top-right or bottom-left can be the furthest away corner as well, potentially resulting in a too small OuterRadius.
This commit is contained in:
reaperrr
2017-05-24 00:26:46 +02:00
committed by atlimit8
parent bc5eb66088
commit 5834d7615b

View File

@@ -67,7 +67,10 @@ namespace OpenRA.Mods.Common.HitShapes
quadrantSize = (BottomRight - TopLeft) / 2;
center = TopLeft + quadrantSize;
OuterRadius = new WDist(Math.Max(TopLeft.Length, BottomRight.Length));
var topRight = new int2(BottomRight.X, TopLeft.Y);
var bottomLeft = new int2(TopLeft.X, BottomRight.Y);
var corners = new[] { TopLeft, BottomRight, topRight, bottomLeft };
OuterRadius = new WDist(corners.Select(x => x.Length).Max());
combatOverlayVertsTop = new WVec[]
{