Skip to content

Commit d5115c1

Browse files
committed
Added warning for RFL < SID CFL
1 parent d6a2e5d commit d5115c1

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

DelHel/CDelHel.cpp

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,13 @@ void CDelHel::OnGetTagItem(EuroScopePlugIn::CFlightPlan FlightPlan, EuroScopePlu
152152
}
153153

154154
*pColorCode = EuroScopePlugIn::TAG_COLOR_RGB_DEFINED;
155-
*pRGB = TAG_COLOR_GREEN;
155+
156+
if (res.color == TAG_COLOR_NONE) {
157+
*pRGB = TAG_COLOR_GREEN;
158+
}
159+
else {
160+
*pRGB = res.color;
161+
}
156162
}
157163
else
158164
{
@@ -413,8 +419,15 @@ validation CDelHel::ProcessFlightPlan(const EuroScopePlugIn::CFlightPlan& fp, bo
413419
}
414420

415421
if (validateOnly) {
416-
// If CFL == RFL, EuroScope returns a CFL of 0. Additionally, CFL 1 and 2 indicate ILS and visual approach clearances respectively
417-
// If the RFL is not adapted or confirmed by the controller, cad.GetFinalAltitude() will also return 0
422+
if (fp.GetFinalAltitude() < sid.cfl) {
423+
res.tag = "RFL";
424+
res.color = TAG_COLOR_ORANGE;
425+
426+
return res;
427+
}
428+
429+
// If CFL == RFL, EuroScope returns a CFL of 0. Additionally, CFL 1 and 2 indicate ILS and visual approach clearances respectively.
430+
// If the RFL is not adapted or confirmed by the controller, cad.GetFinalAltitude() will also return 0.
418431
// To ensure the CFL is actually set, we need to check all three values or check the actual CFL if > 0
419432
if ((cad.GetClearedAltitude() == 0 && fp.GetFinalAltitude() != sid.cfl && cad.GetFinalAltitude() != sid.cfl) ||
420433
(cad.GetClearedAltitude() > 0 && cad.GetClearedAltitude() != sid.cfl)) {
@@ -480,7 +493,17 @@ validation CDelHel::ProcessFlightPlan(const EuroScopePlugIn::CFlightPlan& fp, bo
480493
return res;
481494
}
482495

483-
if (!cad.SetClearedAltitude(sid.cfl)) {
496+
int cfl = sid.cfl;
497+
if (fp.GetFinalAltitude() < sid.cfl) {
498+
this->LogDebugMessage("Flightplan has RFL below initial CFL for SID, setting RFL", cs);
499+
500+
cfl = fp.GetFinalAltitude();
501+
502+
res.tag = "RFL";
503+
res.color = TAG_COLOR_ORANGE;
504+
}
505+
506+
if (!cad.SetClearedAltitude(cfl)) {
484507
this->LogMessage("Failed to process flightplan, cannot set cleared flightlevel", cs);
485508
return res;
486509
}

DelHel/constants.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const int TAG_FUNC_PROCESS_FP_NON_NAP = 103;
2020

2121
const COLORREF TAG_COLOR_NONE = 0;
2222
const COLORREF TAG_COLOR_RED = RGB(200, 0, 0);
23+
const COLORREF TAG_COLOR_ORANGE = RGB(255, 165, 0);
2324
const COLORREF TAG_COLOR_GREEN = RGB(0, 200, 0);
2425

2526
const std::regex REGEX_SPEED_LEVEL_GROUP = std::regex("(((?:N|K)\\d{4})((?:F\\d{3})|(?:S\\d{4})|(?:A\\d{3})|(?:M\\d{4})|(?:VFR)))", std::regex_constants::ECMAScript);

0 commit comments

Comments
 (0)