From 06ca8b6cf2e382d178d0eaa17c94c5d1cd23410c Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 24 Aug 2016 17:20:07 +0100 Subject: [PATCH] Remove hardcoded constant from Fly. --- OpenRA.Mods.Common/Activities/Air/Fly.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Activities/Air/Fly.cs b/OpenRA.Mods.Common/Activities/Air/Fly.cs index 69f22e6700..906f44acde 100644 --- a/OpenRA.Mods.Common/Activities/Air/Fly.cs +++ b/OpenRA.Mods.Common/Activities/Air/Fly.cs @@ -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