1
0
Fork 0

Bugfix NO STAR and transitions, add NO SID

This commit is contained in:
legoboyvdlp R 2020-04-24 12:23:33 +01:00
parent 79a105bd4b
commit 5c63b288fe
4 changed files with 43 additions and 9 deletions

View file

@ -193,6 +193,18 @@ var flightPlanController = {
}
},
insertNOSID: func(n) {
var wptStore = me.flightplans[n].getWP(0);
if (wptStore.wp_type == "runway") {
if (me.flightplans[n].getWP(1).id == "(1500)") { # check if we have NO SID already loaded
me.deleteWP(1, n, 1);
}
# fudge the altitude since we cannot create a hdgtoAlt from nasal. Assume 600 feet per mile - 2.5 miles
me.flightplans[n].insertWP(me.childWPBearingDistance(wptStore, me.flightplans[n].departure_runway.heading, 2.5, "(1500)", "sid"), 1);
}
me.flightPlanChanged(n);
},
insertNOSTAR: func(n) {
var wptStore = me.flightplans[n].getWP(me.arrivalIndex[n]);
if (wptStore.wp_type == "runway") {

View file

@ -499,7 +499,7 @@ var arrivalPage = {
me.scrollStars = 0;
}
me.updateSTARs();
if (me.selectedSTAR == nil or me.selectedSTAR != " NO STAR") {
if (me.selectedSTAR == nil or me.selectedSTAR == " NO STAR") {
me.clearTransitions();
} else {
me.updateTransitions();
@ -524,7 +524,7 @@ var arrivalPage = {
me.scrollStars = size(me.stars) - 4;
}
me.updateSTARs();
if (me.selectedSTAR == nil or me.selectedSTAR != " NO STAR") {
if (me.selectedSTAR == nil or me.selectedSTAR == " NO STAR") {
me.clearTransitions();
} else {
me.updateTransitions();

View file

@ -141,7 +141,13 @@ var departurePage = {
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
updateActiveSIDs: func() {
if (me.selectedSID != nil) {
if (me.selectedSID == " NO SID") {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
me.C1 = ["NONE", "SID", "grn"];
} else {
me.C1 = ["NONE", "SID", "yel"];
}
} elsif (me.selectedSID != nil) {
if (fmgc.flightPlanController.flightplans[2].sid != nil) {
if (fmgc.flightPlanController.flightplans[2].sid == me.selectedSID) {
me.C1 = [fmgc.flightPlanController.flightplans[2].sid.id, "SID", "grn"];
@ -150,7 +156,7 @@ var departurePage = {
} else {
me.C1 = ["------- ", "SID", "wht"];
}
} elsif (fmgc.flightPlanController.flightplans[me.computer].sid.id != nil) {
} elsif (fmgc.flightPlanController.flightplans[me.computer].sid != nil) {
me.C1 = [fmgc.flightPlanController.flightplans[me.computer].sid.id, "SID", "yel"];
} else {
me.C1 = ["------- ", "SID", "wht"];
@ -260,6 +266,12 @@ var departurePage = {
me.sids = sort(me._sids,func(a,b) cmp(a,b));
if (me.sids == nil) {
me.stars = [" NO SID"];
} else {
append(me.sids, " NO SID");
}
if (size(me.sids) >= 1) {
me.L2 = [" " ~ me.sids[0 + me.scrollSids], "SIDS", "blu"];
if (me.sids[0 + me.scrollSids] != me.selectedSID) {
@ -418,7 +430,7 @@ var departurePage = {
me.scrollSids = 0;
}
me.updateSIDs();
if (me.selectedSID == nil) {
if (me.selectedSID == nil or me.selectedSID == " NO SID") {
me.clearTransitions();
} else {
me.updateTransitions();
@ -443,7 +455,7 @@ var departurePage = {
me.scrollSids = size(me.sids) - 4;
}
me.updateSIDs();
if (me.selectedSID == nil) {
if (me.selectedSID == nil or me.selectedSID == " NO SID") {
me.clearTransitions();
} else {
me.updateTransitions();
@ -483,11 +495,20 @@ var departurePage = {
if (!dirToFlag) {
me.selectedSID = me.sids[index - 2 + me.scrollSids];
me.makeTmpy();
fmgc.flightPlanController.flightplans[me.computer].sid = me.selectedSID;
if (me.selectedSID != " NO SID") {
fmgc.flightPlanController.flightplans[me.computer].sid = me.selectedSID;
} else {
fmgc.flightPlanController.flightplans[me.computer].sid = nil;
fmgc.flightPlanController.insertNOSID(me.computer);
}
me.updateActiveSIDs();
me.updateSIDs();
me.hasPressNoTrans = 0;
me.updateTransitions();
if (me.selectedSID != " NO SID") {
me.hasPressNoTrans = 0;
me.updateTransitions();
} else {
me.hasPressNoTrans = 1;
}
me.updateActiveTransitions();
fmgc.flightPlanController.flightPlanChanged(me.computer);
} else {

View file

@ -20,6 +20,7 @@ var latRev = {
arrAirport: nil,
index: nil,
computer: nil,
wpt: nil,
new: func(type, id, index, computer) {
var lr = {parents:[latRev]};
lr.type = type; # 0 = origin 1 = destination 2 = ppos (from waypoint) 3 = generic wpt, 4 = discon