From 3b5a59b5a9604fc6fd853a633918de22514925a0 Mon Sep 17 00:00:00 2001 From: ziz wiz Date: Mon, 15 Jul 2024 16:41:31 +0100 Subject: [PATCH] Corrected a bug in choosing runway in certain conditions. --- myFlightInfo/CrossWind.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/myFlightInfo/CrossWind.cs b/myFlightInfo/CrossWind.cs index be79e63..e338d8e 100644 --- a/myFlightInfo/CrossWind.cs +++ b/myFlightInfo/CrossWind.cs @@ -286,13 +286,15 @@ private void btn_calc_wind_Click(object sender, EventArgs e) HeadwindMultiplier = 1; } + if (crossWind1 > crossWind2) crosswind3 = crossWind1; + if (crossWind2 > crossWind1) crosswind3 = crossWind2; if (crosswind3 > MaxCrossWindAllowed) // crosswind exceeds limits { //Write to richtextbox rchtxtbx_crosswind_output.SelectionColor = Color.Red; rchtxtbx_crosswind_output.SelectionFont = new Font("Ariel", 12); - rchtxtbx_crosswind_output.AppendText("\rNot safe to take off.\rCrosswind component is above maximum allowed for safe takeoff."); + rchtxtbx_crosswind_output.AppendText("\r\rNot safe to take off.\rCrosswind component is above maximum allowed for safe takeoff."); RunwayGraphic.DrawString("X", new Font("Arial", 50), new SolidBrush(Color.White), new Point(60, 120)); } @@ -307,8 +309,8 @@ private void btn_calc_wind_Click(object sender, EventArgs e) if (crosswind3 == 0 && headwind3 == 0) // no wind use any runway. { - if (crossWind1 > crossWind2) crosswind3 = crossWind1; - if (crossWind2 > crossWind1) crosswind3 = crossWind2; + //if (crossWind1 > crossWind2) crosswind3 = crossWind1; + //if (crossWind2 > crossWind1) crosswind3 = crossWind2; // Paint Runway marking RunwayGraphic.DrawString(RunwayHeading1x + "/" + RunwayHeading2x, new Font("Arial", 50),