@@ -53,7 +53,7 @@ bool CDelHel::OnCompileCommand(const char* sCommandLine)
53
53
if (starts_with (args[0 ], " .delhel" )) {
54
54
if (args.size () == 1 ) {
55
55
std::ostringstream msg;
56
- msg << " Version " << PLUGIN_VERSION << " loaded. Available commands: auto, debug, nap, reload, reset, update" ;
56
+ msg << " Version " << PLUGIN_VERSION << " loaded. Available commands: auto, debug, nap, reload, reset, update, rflblw, logminmaxrfl, minmaxrfl, flash " ;
57
57
58
58
this ->LogMessage (msg.str ());
59
59
@@ -434,25 +434,28 @@ void CDelHel::ReadAirportConfig()
434
434
continue ;
435
435
}
436
436
437
- for (auto & [rwy, jsi] : jrwys.items ()) {
437
+ std::ostringstream rrs;
438
+ rrs << icao << " \\ /(" ;
439
+ for (auto it = jrwys.items ().begin (); it != jrwys.items ().end (); ++it) {
438
440
sidinfo si{
439
- rwy , // rwy
440
- jsi .value <std::string>(" dep" , " " ), // dep
441
- jsi .value <std::string>(" nap" , " " ) // nap
441
+ it. key () , // rwy
442
+ it. value () .value <std::string>(" dep" , " " ), // dep
443
+ it. value () .value <std::string>(" nap" , " " ) // nap
442
444
};
443
445
444
446
s.rwys .emplace (si.rwy , si);
445
- ap.rwys .insert (si.rwy );
446
- }
447
-
448
- ap.sids .emplace (wp, s);
447
+ ap.rwys .emplace (si.rwy , false );
449
448
450
- std::ostringstream rrs;
451
- rrs << icao << " \\ /(" ;
452
- std::copy (ap.rwys .begin (), ap.rwys .end (), std::ostream_iterator<std::string>(rrs, " |" ));
449
+ rrs << si.rwy ;
450
+ if (std::next (it) != jrwys.items ().end ()) {
451
+ rrs << ' |' ;
452
+ }
453
+ }
453
454
rrs << ' )' ;
454
455
455
456
ap.rwy_regex = std::regex (rrs.str (), std::regex_constants::ECMAScript);
457
+
458
+ ap.sids .emplace (wp, s);
456
459
}
457
460
458
461
this ->airports .emplace (icao, ap);
@@ -464,21 +467,39 @@ void CDelHel::ReadAirportConfig()
464
467
void CDelHel::UpdateActiveAirports ()
465
468
{
466
469
this ->SelectActiveSectorfile ();
467
- for (auto sfe = this ->SectorFileElementSelectFirst (EuroScopePlugIn::SECTOR_ELEMENT_AIRPORT ); sfe.IsValid (); sfe = this ->SectorFileElementSelectNext (sfe, EuroScopePlugIn::SECTOR_ELEMENT_AIRPORT )) {
468
- std::string dep = sfe.GetName ( );
469
- to_upper (dep );
470
+ for (auto sfe = this ->SectorFileElementSelectFirst (EuroScopePlugIn::SECTOR_ELEMENT_RUNWAY ); sfe.IsValid (); sfe = this ->SectorFileElementSelectNext (sfe, EuroScopePlugIn::SECTOR_ELEMENT_RUNWAY )) {
471
+ std::string ap = trim ( sfe.GetAirportName () );
472
+ to_upper (ap );
470
473
471
- auto ait = this ->airports .find (dep );
474
+ auto ait = this ->airports .find (ap );
472
475
if (ait == this ->airports .end ()) {
473
476
continue ;
474
477
}
475
478
476
- ait->second .active = sfe.IsElementActive (true , 0 );
479
+ std::string rwy = trim (sfe.GetRunwayName (0 ));
480
+ to_upper (rwy);
481
+
482
+ auto rit = ait->second .rwys .find (rwy);
483
+ if (rit != ait->second .rwys .end ()) {
484
+ rit->second = sfe.IsElementActive (true , 0 );
485
+ }
486
+
487
+ rwy = trim (sfe.GetRunwayName (1 ));
488
+ to_upper (rwy);
489
+
490
+ rit = ait->second .rwys .find (rwy);
491
+ if (rit != ait->second .rwys .end ()) {
492
+ rit->second = sfe.IsElementActive (true , 1 );
493
+ }
494
+
495
+ if (!ait->second .active ) {
496
+ ait->second .active = sfe.IsElementActive (true , 0 ) || sfe.IsElementActive (true , 1 );
497
+ }
477
498
}
478
499
}
479
500
480
501
481
- validation CDelHel::ProcessFlightPlan (const EuroScopePlugIn::CFlightPlan& fp, bool nap, bool validateOnly)
502
+ validation CDelHel::ProcessFlightPlan (EuroScopePlugIn::CFlightPlan& fp, bool nap, bool validateOnly)
482
503
{
483
504
validation res{
484
505
true , // valid
@@ -617,18 +638,35 @@ validation CDelHel::ProcessFlightPlan(const EuroScopePlugIn::CFlightPlan& fp, bo
617
638
return res;
618
639
}
619
640
641
+ std::map<std::string, sidinfo>::iterator sit;
620
642
std::string rwy = fpd.GetDepartureRwy ();
621
643
if (rwy == " " ) {
622
- this ->LogMessage ( " Failed to process flightplan, no runway assigned " , cs);
644
+ this ->LogDebugMessage ( " No runway assigned, attempting to pick first active runway for SID " , cs);
623
645
624
- res.valid = false ;
625
- res.tag = " RWY" ;
626
- res.color = TAG_COLOR_RED;
646
+ for (auto [r, active] : ap.rwys ) {
647
+ if (active) {
648
+ sit = sid.rwys .find (r);
649
+ if (sit != sid.rwys .end ()) {
650
+ rwy = r;
651
+ break ;
652
+ }
653
+ }
654
+ }
627
655
628
- return res;
656
+ if (rwy == " " ) {
657
+ this ->LogMessage (" Failed to process flightplan, no runway assigned" , cs);
658
+
659
+ res.valid = false ;
660
+ res.tag = " RWY" ;
661
+ res.color = TAG_COLOR_RED;
662
+
663
+ return res;
664
+ }
665
+ }
666
+ else {
667
+ sit = sid.rwys .find (rwy);
629
668
}
630
669
631
- auto sit = sid.rwys .find (rwy);
632
670
if (sit == sid.rwys .end ()) {
633
671
this ->LogMessage (" Invalid flightplan, no matching SID found for runway" , cs);
634
672
@@ -701,7 +739,6 @@ validation CDelHel::ProcessFlightPlan(const EuroScopePlugIn::CFlightPlan& fp, bo
701
739
for (auto wyprouit = vait->waypts .begin (); wyprouit != vait->waypts .end (); ++wyprouit) {
702
740
for (auto wypfpl = fpl.route .begin () + count; wypfpl != fpl.route .end (); ++wypfpl) {
703
741
704
- this ->LogDebugMessage (" Looking for json-Wypt: " + *wyprouit + " comparing to fpl-Wypt: " + wypfpl->name , cs);
705
742
if (wypfpl->airway && wypfpl->name .rfind (*wyprouit) == 0 ) { // check if waypoint name is part of the airway (e.g. SID)
706
743
707
744
routecheck = true ;
0 commit comments