From 119950cc1aa940c208a6ecd0b5d63721164fcf90 Mon Sep 17 00:00:00 2001 From: Arthur <89831445+arthuwu@users.noreply.github.com> Date: Sat, 13 Jul 2024 17:04:08 +0100 Subject: [PATCH] Disable route and approach selection if destination is not defined (#25) --- AT3/AT3Tags.cpp | 77 ++++++++++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 33 deletions(-) diff --git a/AT3/AT3Tags.cpp b/AT3/AT3Tags.cpp index 34572b05..0d729b9c 100644 --- a/AT3/AT3Tags.cpp +++ b/AT3/AT3Tags.cpp @@ -283,11 +283,13 @@ void AT3Tags::OnFunctionCall(int FunctionId, const char* sItemString, POINT Pt, } switch (FunctionId) { - case TAG_FUNC_APP_SEL_MENU: + case TAG_FUNC_APP_SEL_MENU: + if (arptSet.find(FlightPlan.GetFlightPlanData().GetDestination()) != arptSet.end()) { OpenPopupList(Area, APPMenuName.c_str(), 1); if (appsVec.size() > 0) { AddPopupListElement(appsVec[0].c_str(), "", TAG_FUNC_APP_SEL_ITEM_1, false, 2, false); - } else { + } + else { AddPopupListElement("BAD DATA ", "", TAG_FUNC_APP_SEL_DUMMY, false, 2, false); break; } @@ -340,40 +342,45 @@ void AT3Tags::OnFunctionCall(int FunctionId, const char* sItemString, POINT Pt, else { break; } - - case TAG_FUNC_APP_SEL_ITEM_1: { - SetApp(0, FlightPlan, appsVec); - break; - } - case TAG_FUNC_APP_SEL_ITEM_2: { - SetApp(1, FlightPlan, appsVec); - break; - } - case TAG_FUNC_APP_SEL_ITEM_3: { - SetApp(2, FlightPlan, appsVec); - break; - } - case TAG_FUNC_APP_SEL_ITEM_4: { - SetApp(3, FlightPlan, appsVec); - break; - } - case TAG_FUNC_APP_SEL_ITEM_5: { - SetApp(4, FlightPlan, appsVec); - break; - } - case TAG_FUNC_APP_SEL_ITEM_6: { - SetApp(5, FlightPlan, appsVec); - break; - } - case TAG_FUNC_APP_SEL_ITEM_7: { - SetApp(6, FlightPlan, appsVec); - break; } - case TAG_FUNC_APP_SEL_ITEM_8: { - SetApp(7, FlightPlan, appsVec); + else { break; } - case TAG_FUNC_RTE_SEL_MENU: + + case TAG_FUNC_APP_SEL_ITEM_1: { + SetApp(0, FlightPlan, appsVec); + break; + } + case TAG_FUNC_APP_SEL_ITEM_2: { + SetApp(1, FlightPlan, appsVec); + break; + } + case TAG_FUNC_APP_SEL_ITEM_3: { + SetApp(2, FlightPlan, appsVec); + break; + } + case TAG_FUNC_APP_SEL_ITEM_4: { + SetApp(3, FlightPlan, appsVec); + break; + } + case TAG_FUNC_APP_SEL_ITEM_5: { + SetApp(4, FlightPlan, appsVec); + break; + } + case TAG_FUNC_APP_SEL_ITEM_6: { + SetApp(5, FlightPlan, appsVec); + break; + } + case TAG_FUNC_APP_SEL_ITEM_7: { + SetApp(6, FlightPlan, appsVec); + break; + } + case TAG_FUNC_APP_SEL_ITEM_8: { + SetApp(7, FlightPlan, appsVec); + break; + } + case TAG_FUNC_RTE_SEL_MENU: + if (arptSet.find(FlightPlan.GetFlightPlanData().GetDestination()) != arptSet.end()) { OpenPopupList(Area, RteMenuName.c_str(), 1); if (rteVec.size() > 0) { AddPopupListElement(rteVec[0].c_str(), "", TAG_FUNC_RTE_SEL_ITEM_1, false, 2, false); @@ -431,6 +438,10 @@ void AT3Tags::OnFunctionCall(int FunctionId, const char* sItemString, POINT Pt, else { break; } + } + else { + break; + } case TAG_FUNC_RTE_SEL_ITEM_1: { SetRte(0, FlightPlan, rteVec, dest, destRunway); break;