From f256742a0dd974b0485fc6c46629164ec1cc8e36 Mon Sep 17 00:00:00 2001 From: Carko Date: Tue, 1 Jan 2013 16:56:38 +0100 Subject: [PATCH] Fixed repairing landed airplanes (most likely #2365) When an airplane was landed and ordered to another airstrip or service depot, the aproach distance was not properly calculated since it was not taken into effect that its current altitude is zero. --- OpenRA.Mods.RA/Air/ReturnToBase.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.RA/Air/ReturnToBase.cs b/OpenRA.Mods.RA/Air/ReturnToBase.cs index e21762e576..e2b4285890 100755 --- a/OpenRA.Mods.RA/Air/ReturnToBase.cs +++ b/OpenRA.Mods.RA/Air/ReturnToBase.cs @@ -52,7 +52,11 @@ namespace OpenRA.Mods.RA.Air var speed = .2f * aircraft.MovementSpeed; - var approachStart = landPos.ToFloat2() - new float2(aircraft.Altitude * speed, 0); + /* if the aircraft is on the ground, it will take off to the cruise altitude first before approaching */ + var altitude = aircraft.Altitude; + if (altitude == 0) altitude = self.Info.Traits.Get().CruiseAltitude; + + var approachStart = landPos.ToFloat2() - new float2(altitude * speed, 0); var turnRadius = (128f / self.Info.Traits.Get().ROT) * speed / (float)Math.PI; /* work out the center points */