Remove hardcoded constant from Fly.

This commit is contained in:
Paul Chote
2016-08-24 17:20:07 +01:00
parent 9572376de0
commit 06ca8b6cf2

View File

@@ -66,9 +66,11 @@ namespace OpenRA.Mods.Common.Activities
if (insideMaxRange && !insideMinRange)
return NextActivity;
// Close enough (ported from old code which checked length against sqrt(50) px)
var d = target.CenterPosition - self.CenterPosition;
if (d.HorizontalLengthSquared < 91022)
// The next move would overshoot, so consider it close enough
var move = plane.FlyStep(plane.Facing);
if (d.HorizontalLengthSquared < move.HorizontalLengthSquared)
return NextActivity;
// Don't turn until we've reached the cruise altitude