Merge pull request #11871 from pchote/fix-production-circle

Remove hardcoded constants from Fly and ProductionAirdrop.
This commit is contained in:
Matthias Mailänder
2016-08-27 19:43:15 +02:00
committed by GitHub
2 changed files with 17 additions and 11 deletions

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