From f98b5cd4829100804775d180766dc9b9a07395e6 Mon Sep 17 00:00:00 2001 From: scttgs0 Date: Sun, 14 May 2023 17:37:31 -0500 Subject: [PATCH] [rwy_simple] Maintenance --- src/Airports/GenAirports/rwy_simple.cxx | 82 ++++++++++++------------- 1 file changed, 40 insertions(+), 42 deletions(-) diff --git a/src/Airports/GenAirports/rwy_simple.cxx b/src/Airports/GenAirports/rwy_simple.cxx index 98fb1c45..28080a71 100644 --- a/src/Airports/GenAirports/rwy_simple.cxx +++ b/src/Airports/GenAirports/rwy_simple.cxx @@ -23,21 +23,20 @@ #include #include -#include "runway.hxx" #include "debug.hxx" +#include "runway.hxx" -using std::string; // generate a simple runway -void Runway::gen_simple_rwy( tgpolygon_list& rwy_polys, - tgcontour_list& slivers, - tgAccumulator& accum ) +void Runway::gen_simple_rwy(tgpolygon_list& rwy_polys, + tgcontour_list& slivers, + tgAccumulator& accum) { - tgContour runway = gen_runway_w_mid( 0.0, 0.0 ); + tgContour runway = gen_runway_w_mid(0.0, 0.0); tgPolygon runway_half; - std::string empty = ""; + std::string empty{}; - for ( int rwhalf=0; rwhalf<2; ++rwhalf ) { + for (int rwhalf = 0; rwhalf < 2; ++rwhalf) { double length = rwy.length / 2.0; double end_pct = 0.0; double heading = 0.0; @@ -47,52 +46,51 @@ void Runway::gen_simple_rwy( tgpolygon_list& rwy_polys, //Create the first half of the runway (first entry in apt.dat) runway_half.Erase(); - runway_half.AddNode( 0, runway.GetNode(3) ); - runway_half.AddNode( 0, runway.GetNode(4) ); - runway_half.AddNode( 0, runway.GetNode(5) ); - runway_half.AddNode( 0, runway.GetNode(2) ); - } - else { + runway_half.AddNode(0, runway.GetNode(3)); + runway_half.AddNode(0, runway.GetNode(4)); + runway_half.AddNode(0, runway.GetNode(5)); + runway_half.AddNode(0, runway.GetNode(2)); + } else { heading = rwy.heading; //Create the second runway half from apt.dat runway_half.Erase(); - runway_half.AddNode( 0, runway.GetNode(0) ); - runway_half.AddNode( 0, runway.GetNode(1) ); - runway_half.AddNode( 0, runway.GetNode(2) ); - runway_half.AddNode( 0, runway.GetNode(5) ); + runway_half.AddNode(0, runway.GetNode(0)); + runway_half.AddNode(0, runway.GetNode(1)); + runway_half.AddNode(0, runway.GetNode(2)); + runway_half.AddNode(0, runway.GetNode(5)); } - TG_LOG( SG_GENERAL, SG_DEBUG, "runway marking = " << rwy.marking[rwhalf] ); + TG_LOG(SG_GENERAL, SG_DEBUG, "runway marking = " << rwy.marking[rwhalf]); // Displaced threshold if it exists - if ( rwy.threshold[rwhalf] > 0.0 ) { - TG_LOG( SG_GENERAL, SG_DEBUG, "Displaced threshold for RW side " << rwhalf << " is " << rwy.threshold[rwhalf] ); + if (rwy.threshold[rwhalf] > 0.0) { + TG_LOG(SG_GENERAL, SG_DEBUG, "Displaced threshold for RW side " << rwhalf << " is " << rwy.threshold[rwhalf]); double start_pct = end_pct; - end_pct = start_pct + ( rwy.threshold[rwhalf] / length ); - Runway::gen_runway_section( runway_half, - start_pct, end_pct, - 0.0, 1.0, - 0.0, 1.0, 0.0, 1.0, - heading, - "", - rwy_polys, - slivers, - accum, - empty ); + end_pct = start_pct + (rwy.threshold[rwhalf] / length); + Runway::gen_runway_section(runway_half, + start_pct, end_pct, + 0.0, 1.0, + 0.0, 1.0, 0.0, 1.0, + heading, + "", + rwy_polys, + slivers, + accum, + empty); } // Generate runway - Runway::gen_runway_section( runway_half, - end_pct, 1.0, - 0.0, 1.0, - 0.0, 0.28, 0.0, 1.0, - heading, - "", - rwy_polys, - slivers, - accum, - empty ); + Runway::gen_runway_section(runway_half, + end_pct, 1.0, + 0.0, 1.0, + 0.0, 0.28, 0.0, 1.0, + heading, + "", + rwy_polys, + slivers, + accum, + empty); } }