From 996372de0232796d64bb5a861621a35f07431ef9 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 25 Oct 2020 21:47:47 +0000 Subject: [PATCH] Add procedures parsing to Simbrief parser again. --- Nasal/FMGC/SimbriefParser.nas | 40 +++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index 093c5d8e..f5f1cfe1 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -116,18 +116,48 @@ var SimbriefParser = { var ident = ""; var coords = nil; var wp = nil; + var _foundSID = 0; + var _foundSTAR = 0; + var _foundTOC = 0; + var _foundTOD = 0; + var _sid = nil; + var _star = nil; foreach (var ofpFix; ofpFixes) { if (ofpFix.getNode("is_sid_star").getBoolValue()) { - # continue; + if (!_foundSID) { + _sid = fmgc.flightPlanController.flightplans[3].departure.getSid(ofpFix.getNode("via_airway").getValue()); + if (_sid != nil) { + _foundSID = 1; + } + } } + if (ofpFix.getNode("is_sid_star").getBoolValue()) { + if (!_foundSTAR) { + _star = fmgc.flightPlanController.flightplans[3].destination.getStar(ofpFix.getNode("via_airway").getValue()); + if (_star != nil) { + _foundSTAR = 1; + } + } + } + + if (ofpFix.getNode("is_sid_star").getBoolValue() and _foundSID and _foundSTAR) { + continue; + } # todo what happens if you don't find one but find the other + ident = ofpFix.getNode("ident").getValue(); if (find(departureID, ident) != -1 or find(destinationID, ident) != -1) { continue; } - if (ident == "TOC" or ident == "TOD") { + if (ident == "TOC") { + _foundTOC = 1; + continue; + } + + if (ident == "TOD") { + _foundTOC = 1; continue; } @@ -146,6 +176,12 @@ var SimbriefParser = { } fmgc.flightPlanController.flightplans[3].insertWaypoints(wps, 1); + if (_sid != nil) { + fmgc.flightPlanController.flightplans[3].sid = _sid; + } + if (_star != nil) { + fmgc.flightPlanController.flightplans[3].star = _star; + } fmgc.flightPlanController.destroyTemporaryFlightPlan(3, 1); fmgc.windController.updatePlans(); fmgc.updateRouteManagerAlt();