Skip to content

Commit 1d73571

Browse files
committed
Added option for logging min/max RFLs for predefined routings
Will always be displayed while using debug mode, can optionally be toggled on while debug mode is disabled
1 parent a16e10c commit 1d73571

File tree

3 files changed

+81
-2
lines changed

3 files changed

+81
-2
lines changed

DelHel/CDelHel.cpp

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ CDelHel::CDelHel() : EuroScopePlugIn::CPlugIn(
2828
this->assignNap = false;
2929
this->autoProcess = false;
3030
this->warnRFLBelowCFL = false;
31+
this->logMinMaxRFL = false;
3132

3233
this->LoadSettings();
3334

@@ -140,6 +141,18 @@ bool CDelHel::OnCompileCommand(const char* sCommandLine)
140141

141142
this->warnRFLBelowCFL = !this->warnRFLBelowCFL;
142143

144+
return true;
145+
}
146+
else if (args[1] == "minmaxrfl") {
147+
if (this->logMinMaxRFL) {
148+
this->LogMessage("No longer logging min and max RFLs for predefined routings", "Config");
149+
}
150+
else {
151+
this->LogMessage("Logging min and max RFLs for predefined routings", "Config");
152+
}
153+
154+
this->logMinMaxRFL = !this->logMinMaxRFL;
155+
143156
return true;
144157
}
145158
}
@@ -234,7 +247,7 @@ void CDelHel::LoadSettings()
234247
if (settings) {
235248
std::vector<std::string> splitSettings = split(settings, SETTINGS_DELIMITER);
236249

237-
if (splitSettings.size() < 4) {
250+
if (splitSettings.size() < 5) {
238251
this->LogMessage("Invalid saved settings found, reverting to default.");
239252

240253
this->SaveSettings();
@@ -246,6 +259,7 @@ void CDelHel::LoadSettings()
246259
std::istringstream(splitSettings[1]) >> this->updateCheck;
247260
std::istringstream(splitSettings[2]) >> this->assignNap;
248261
std::istringstream(splitSettings[3]) >> this->warnRFLBelowCFL;
262+
std::istringstream(splitSettings[4]) >> this->logMinMaxRFL;
249263

250264
this->LogDebugMessage("Successfully loaded settings.");
251265
}
@@ -260,7 +274,8 @@ void CDelHel::SaveSettings()
260274
ss << this->debug << SETTINGS_DELIMITER
261275
<< this->updateCheck << SETTINGS_DELIMITER
262276
<< this->assignNap << SETTINGS_DELIMITER
263-
<< this->warnRFLBelowCFL;
277+
<< this->warnRFLBelowCFL << SETTINGS_DELIMITER
278+
<< this->logMinMaxRFL;
264279

265280
this->SaveDataToSettings(PLUGIN_NAME, "DelHel settings", ss.str().c_str());
266281
}
@@ -645,13 +660,39 @@ validation CDelHel::ProcessFlightPlan(const EuroScopePlugIn::CFlightPlan& fp, bo
645660
res.valid = false;
646661
res.tag = "MAX";
647662
res.color = TAG_COLOR_ORANGE;
663+
664+
if (!validateOnly) {
665+
std::ostringstream msg;
666+
msg << "Flights from " << dep << " to " << arr << " via " << sid.wp << " have a maximum FL of " << vait->maxlvl;
667+
668+
if (this->logMinMaxRFL) {
669+
this->LogMessage(msg.str(), cs);
670+
}
671+
else {
672+
this->LogDebugMessage(msg.str(), cs);
673+
}
674+
}
675+
648676
return res;
649677
}
650678
if ((cad.GetFinalAltitude() == 0 && fpd.GetFinalAltitude() < vait->minlvl * 100) || (cad.GetFinalAltitude() != 0 && cad.GetFinalAltitude() < vait->minlvl * 100)) {
651679

652680
res.valid = false;
653681
res.tag = "MIN";
654682
res.color = TAG_COLOR_ORANGE;
683+
684+
if (!validateOnly) {
685+
std::ostringstream msg;
686+
msg << "Flights from " << dep << " to " << arr << " via " << sid.wp << " have a minimum FL of " << vait->minlvl;
687+
688+
if (this->logMinMaxRFL) {
689+
this->LogMessage(msg.str(), cs);
690+
}
691+
else {
692+
this->LogDebugMessage(msg.str(), cs);
693+
}
694+
}
695+
655696
return res;
656697
}
657698

@@ -669,13 +710,39 @@ validation CDelHel::ProcessFlightPlan(const EuroScopePlugIn::CFlightPlan& fp, bo
669710
res.valid = false;
670711
res.tag = "MAX";
671712
res.color = TAG_COLOR_ORANGE;
713+
714+
if (!validateOnly) {
715+
std::ostringstream msg;
716+
msg << "Flights from " << dep << " via " << sid.wp << " have a maximum FL of " << vait->maxlvl;
717+
718+
if (this->logMinMaxRFL) {
719+
this->LogMessage(msg.str(), cs);
720+
}
721+
else {
722+
this->LogDebugMessage(msg.str(), cs);
723+
}
724+
}
725+
672726
break;
673727
}
674728
if ((cad.GetFinalAltitude() == 0 && fpd.GetFinalAltitude() < vait->minlvl * 100) || (cad.GetFinalAltitude() != 0 && cad.GetFinalAltitude() < vait->minlvl * 100)) {
675729

676730
res.valid = false;
677731
res.tag = "MIN";
678732
res.color = TAG_COLOR_ORANGE;
733+
734+
if (!validateOnly) {
735+
std::ostringstream msg;
736+
msg << "Flights from " << dep << " via " << sid.wp << " have a minimum FL of " << vait->minlvl;
737+
738+
if (this->logMinMaxRFL) {
739+
this->LogMessage(msg.str(), cs);
740+
}
741+
else {
742+
this->LogDebugMessage(msg.str(), cs);
743+
}
744+
}
745+
679746
break;
680747
}
681748

DelHel/CDelHel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class CDelHel : public EuroScopePlugIn::CPlugIn
4141
bool assignNap;
4242
bool autoProcess;
4343
bool warnRFLBelowCFL;
44+
bool logMinMaxRFL;
4445
std::future<std::string> latestVersion;
4546
std::map<std::string, airport> airports;
4647
std::vector<std::string> processed;

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,17 @@ If disabled (default setting), `DelHel` will display no indication and silently
227227

228228
This setting will be saved to the EuroScope settings upon exit.
229229

230+
#### Toggle logging of min and max RFLs
231+
232+
`.delhel minmaxrfl`
233+
234+
Toggles logging of min and max RFLs for predefined routings during flightplan processing.
235+
236+
If enabled, `DelHel` will display the min/max value triggering a warning during flightplan processing, informing you about the limit defined in the routing config.
237+
If disabled (default setting), `DelHel` will only display the min/max RFL values if the [debug mode](#toggle-debug-logging) is enabled.
238+
239+
This setting will be saved to the EuroScope settings upon exit.
240+
230241
### Airport config
231242

232243
`DelHel` uses its airport config, stored in the `airports.json` file in the same directory as the `DelHel.dll` plugin DLL, to retrieve most of its configuration for validations and flightplan processing.

0 commit comments

Comments
 (0)