add new long WRange.RangeSquared to avoid integer overflows

This commit is contained in:
Matthias Mailänder
2015-05-31 23:51:30 +02:00
parent 79edf648a7
commit ea5003cd2d
15 changed files with 18 additions and 22 deletions

View File

@@ -262,9 +262,8 @@ namespace OpenRA.Mods.Common.Traits
if (modifiers.HasModifier(TargetModifiers.ForceAttack))
{
var maxRange = ab.GetMaximumRange().Range;
var targetRange = (self.World.Map.CenterOfCell(location) - self.CenterPosition).HorizontalLengthSquared;
if (targetRange > maxRange * maxRange)
if (targetRange > ab.GetMaximumRange().RangeSquared)
cursor = ab.Info.OutsideRangeCursor;
return true;