Skip to content

Commit

Permalink
Corrected a bug in choosing runway in certain conditions.
Browse files Browse the repository at this point in the history
  • Loading branch information
zizwiz committed Jul 15, 2024
1 parent abbefe5 commit 3b5a59b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions myFlightInfo/CrossWind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand All @@ -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),
Expand Down

0 comments on commit 3b5a59b

Please sign in to comment.