Major improvements - discontinuity, lat rev, sequencing, etc
This commit is contained in:
parent
b41269af8a
commit
d36c9505ce
7 changed files with 456 additions and 48 deletions
|
@ -129,6 +129,9 @@ var flightplan = {
|
|||
}
|
||||
|
||||
currentWP[2] = 0;
|
||||
|
||||
# Create discontinuity
|
||||
fmgc.fp[2].insertWP(createDiscontinuity(), 1);
|
||||
}
|
||||
|
||||
me.checkWPOutputs(n);
|
||||
|
|
163
Nasal/MCDU/ARRIVAL.nas
Normal file
163
Nasal/MCDU/ARRIVAL.nas
Normal file
|
@ -0,0 +1,163 @@
|
|||
var arrivalPage = {
|
||||
title: [nil, nil, nil],
|
||||
subtitle: [nil, nil],
|
||||
fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
|
||||
arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
|
||||
arrowsColour: [["ack", "ack", "ack", "ack", "ack", "ack"],["ack", "ack", "ack", "ack", "ack", "ack"]],
|
||||
L1: [nil, nil, "ack"], # content, title, colour
|
||||
L2: [nil, nil, "ack"],
|
||||
L3: [nil, nil, "ack"],
|
||||
L4: [nil, nil, "ack"],
|
||||
L5: [nil, nil, "ack"],
|
||||
L6: [nil, nil, "ack"],
|
||||
C1: [nil, nil, "ack"],
|
||||
C2: [nil, nil, "ack"],
|
||||
C3: [nil, nil, "ack"],
|
||||
C4: [nil, nil, "ack"],
|
||||
C5: [nil, nil, "ack"],
|
||||
C6: [nil, nil, "ack"],
|
||||
R1: [nil, nil, "ack"],
|
||||
R2: [nil, nil, "ack"],
|
||||
R3: [nil, nil, "ack"],
|
||||
R4: [nil, nil, "ack"],
|
||||
R5: [nil, nil, "ack"],
|
||||
R6: [nil, nil, "ack"],
|
||||
arrAirport: nil,
|
||||
runways: nil,
|
||||
selectedRunway: nil,
|
||||
sids: nil,
|
||||
computer: nil,
|
||||
enableScroll: 0,
|
||||
scroll: 0,
|
||||
_runways: nil,
|
||||
_sids: nil,
|
||||
new: func(icao, computer) {
|
||||
var lr = {parents:[arrivalPage]};
|
||||
lr.id = icao;
|
||||
lr.computer = computer;
|
||||
lr._setupPageWithData();
|
||||
lr.updateRunways();
|
||||
if (fmgc.fp[2].destination_runway != nil) {
|
||||
lr.selectedRunway = fmgc.fp[2].destination_runway;
|
||||
}
|
||||
lr.updateActiveRunway();
|
||||
return lr;
|
||||
},
|
||||
del: func() {
|
||||
return nil;
|
||||
},
|
||||
_setupPageWithData: func() {
|
||||
me.title = ["ARRIVAL", " TO ", left(me.id, 4)];
|
||||
if (!TMPYActive[me.computer].getBoolValue()) {
|
||||
me.L6 = [" RETURN END", nil, "wht"];
|
||||
} else {
|
||||
me.L6 = [" F-PLN", " TMPY", "yel"];
|
||||
me.arrowsColour[0][5] = "yel";
|
||||
}
|
||||
|
||||
me.C1 = ["------- ", "VIA", "wht"];
|
||||
me.R1 = ["-------", "STAR ", "wht"];
|
||||
me.R1 = ["-------", "TRANS ", "wht"];
|
||||
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
|
||||
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]];
|
||||
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]];
|
||||
},
|
||||
updateActiveRunway: func() {
|
||||
if (me.selectedRunway != nil) {
|
||||
if (fmgc.fp[2].destination_runway != nil) {
|
||||
if (fmgc.fp[2].destination_runway.id == me.selectedRunway.id) {
|
||||
me.L1 = [fmgc.fp[2].destination_runway.id, " RWY", "grn"];
|
||||
} elsif (fmgc.fp[me.computer].destination_runway != nil) {
|
||||
me.L1 = [fmgc.fp[me.computer].destination_runway.id, " RWY", "yel"];
|
||||
} else {
|
||||
me.L1 = ["---", " RWY", "wht"];
|
||||
}
|
||||
} elsif (fmgc.fp[me.computer].destination_runway != nil) {
|
||||
me.L1 = [fmgc.fp[me.computer].destination_runway.id, " RWY", "yel"];
|
||||
} else {
|
||||
me.L1 = ["---", " RWY", "wht"];
|
||||
}
|
||||
} else {
|
||||
me.L1 = ["---", " RWY", "wht"];
|
||||
}
|
||||
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
||||
},
|
||||
updateRunways: func() {
|
||||
me.arrAirport = findAirportsByICAO(left(me.id, 4));
|
||||
me._runways = keys(me.arrAirport[0].runways);
|
||||
me.runways = sort(me._runways,func(a,b) cmp(a,b));
|
||||
|
||||
me.fourRunways = [nil, nil, nil, nil];
|
||||
|
||||
if (size(me.runways) >= 1) {
|
||||
me.L2 = [" " ~ me.runways[0 + me.scroll], nil, "blu"];
|
||||
me.C2 = [math.round(me.arrAirport[0].runways[me.runways[0 + me.scroll]].length) ~ "M", nil, "blu"];
|
||||
me.R2 = ["CRS" ~ math.round(me.arrAirport[0].runways[me.runways[0 + me.scroll]].heading), nil, "blu"];
|
||||
me.arrowsMatrix[0][1] = 1;
|
||||
me.arrowsColour[0][1] = "blu";
|
||||
}
|
||||
if (size(me.runways) >= 2) {
|
||||
me.L3 = [" " ~ me.runways[1 + me.scroll], nil, "blu"];
|
||||
me.C3 = [math.round(me.arrAirport[0].runways[me.runways[1 + me.scroll]].length) ~ "M", nil, "blu"];
|
||||
me.R3 = ["CRS" ~ math.round(me.arrAirport[0].runways[me.runways[1 + me.scroll]].heading), nil, "blu"];
|
||||
me.arrowsMatrix[0][2] = 1;
|
||||
me.arrowsColour[0][2] = "blu";
|
||||
}
|
||||
if (size(me.runways) >= 3) {
|
||||
me.L4 = [" " ~ me.runways[2 + me.scroll], nil, "blu"];
|
||||
me.C4 = [math.round(me.arrAirport[0].runways[me.runways[2 + me.scroll]].length) ~ "M", nil, "blu"];
|
||||
me.R4 = ["CRS" ~ math.round(me.arrAirport[0].runways[me.runways[2 + me.scroll]].heading), nil, "blu"];
|
||||
me.arrowsMatrix[0][3] = 1;
|
||||
me.arrowsColour[0][3] = "blu";
|
||||
}
|
||||
if (size(me.runways) >= 4) {
|
||||
me.L5 = [" " ~ me.runways[3 + me.scroll], nil, "blu"];
|
||||
me.C5 = [math.round(me.arrAirport[0].runways[me.runways[3 + me.scroll]].length) ~ "M", nil, "blu"];
|
||||
me.R5 = ["CRS" ~ math.round(me.arrAirport[0].runways[me.runways[3 + me.scroll]].heading), nil, "blu"];
|
||||
me.arrowsMatrix[0][4] = 1;
|
||||
me.arrowsColour[0][4] = "blu";
|
||||
}
|
||||
|
||||
if (size(me.runways) > 4) {
|
||||
me.enableScroll = 1;
|
||||
}
|
||||
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
||||
},
|
||||
makeTmpy: func() {
|
||||
if (!TMPYActive[me.computer].getBoolValue()) {
|
||||
fmgc.flightplan.initTempFP(me.computer, 2);
|
||||
me.L6 = [" F-PLN", " TMPY", "yel"];
|
||||
me.arrowsColour[0][5] = "yel";
|
||||
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
||||
}
|
||||
},
|
||||
scrollUp: func() {
|
||||
if (me.enableScroll) {
|
||||
me.scroll += 1;
|
||||
if (me.scroll > size(me.runways) - 4) {
|
||||
me.scroll = 0;
|
||||
}
|
||||
me.updateRunways();
|
||||
}
|
||||
},
|
||||
scrollDn: func() {
|
||||
if (me.enableScroll) {
|
||||
me.scroll -= 1;
|
||||
if (me.scroll < 0) {
|
||||
me.scroll = size(me.runways) - 4;
|
||||
}
|
||||
me.updateRunways();
|
||||
}
|
||||
},
|
||||
depPushbuttonLeft: func(index) {
|
||||
if (size(me.runways) >= (index - 1)) {
|
||||
me.selectedRunway = me.arrAirport[0].runway(me.runways[index - 2 + me.scroll]);
|
||||
me.makeTmpy();
|
||||
fmgc.fp[me.computer].destination_runway = me.selectedRunway;
|
||||
me.updateActiveRunway();
|
||||
fmgc.flightplan.checkWPOutputs(me.computer);
|
||||
} else {
|
||||
notAllowed(me.computer);
|
||||
}
|
||||
},
|
||||
};
|
|
@ -28,6 +28,7 @@ var departurePage = {
|
|||
sids: nil,
|
||||
computer: nil,
|
||||
enableScroll: 0,
|
||||
scroll: 0,
|
||||
_runways: nil,
|
||||
_sids: nil,
|
||||
new: func(icao, computer) {
|
||||
|
@ -36,6 +37,9 @@ var departurePage = {
|
|||
lr.computer = computer;
|
||||
lr._setupPageWithData();
|
||||
lr.updateRunways();
|
||||
if (fmgc.fp[2].departure_runway != nil) {
|
||||
lr.selectedRunway = fmgc.fp[2].departure_runway;
|
||||
}
|
||||
lr.updateActiveRunway();
|
||||
return lr;
|
||||
},
|
||||
|
@ -61,7 +65,7 @@ var departurePage = {
|
|||
if (me.selectedRunway != nil) {
|
||||
if (fmgc.fp[2].departure_runway != nil) {
|
||||
if (fmgc.fp[2].departure_runway.id == me.selectedRunway.id) {
|
||||
me.L1 = [fmgc.fp[me.computer].departure_runway.id, " RWY", "grn"];
|
||||
me.L1 = [fmgc.fp[2].departure_runway.id, " RWY", "grn"];
|
||||
} elsif (fmgc.fp[me.computer].departure_runway != nil) {
|
||||
me.L1 = [fmgc.fp[me.computer].departure_runway.id, " RWY", "yel"];
|
||||
} else {
|
||||
|
@ -85,30 +89,30 @@ var departurePage = {
|
|||
me.fourRunways = [nil, nil, nil, nil];
|
||||
|
||||
if (size(me.runways) >= 1) {
|
||||
me.L2 = [" " ~ me.runways[0], nil, "blu"];
|
||||
me.C2 = [math.round(me.depAirport[0].runways[me.runways[0]].length) ~ "M", nil, "blu"];
|
||||
me.R2 = ["CRS" ~ math.round(me.depAirport[0].runways[me.runways[0]].heading), nil, "blu"];
|
||||
me.L2 = [" " ~ me.runways[0 + me.scroll], nil, "blu"];
|
||||
me.C2 = [math.round(me.depAirport[0].runways[me.runways[0 + me.scroll]].length) ~ "M", nil, "blu"];
|
||||
me.R2 = ["CRS" ~ math.round(me.depAirport[0].runways[me.runways[0 + me.scroll]].heading), nil, "blu"];
|
||||
me.arrowsMatrix[0][1] = 1;
|
||||
me.arrowsColour[0][1] = "blu";
|
||||
}
|
||||
if (size(me.runways) >= 2) {
|
||||
me.L3 = [" " ~ me.runways[1], nil, "blu"];
|
||||
me.C3 = [math.round(me.depAirport[0].runways[me.runways[1]].length) ~ "M", nil, "blu"];
|
||||
me.R3 = ["CRS" ~ math.round(me.depAirport[0].runways[me.runways[1]].heading), nil, "blu"];
|
||||
me.L3 = [" " ~ me.runways[1 + me.scroll], nil, "blu"];
|
||||
me.C3 = [math.round(me.depAirport[0].runways[me.runways[1 + me.scroll]].length) ~ "M", nil, "blu"];
|
||||
me.R3 = ["CRS" ~ math.round(me.depAirport[0].runways[me.runways[1 + me.scroll]].heading), nil, "blu"];
|
||||
me.arrowsMatrix[0][2] = 1;
|
||||
me.arrowsColour[0][2] = "blu";
|
||||
}
|
||||
if (size(me.runways) >= 3) {
|
||||
me.L4 = [" " ~ me.runways[2], nil, "blu"];
|
||||
me.C4 = [math.round(me.depAirport[0].runways[me.runways[2]].length) ~ "M", nil, "blu"];
|
||||
me.R4 = ["CRS" ~ math.round(me.depAirport[0].runways[me.runways[2]].heading), nil, "blu"];
|
||||
me.L4 = [" " ~ me.runways[2 + me.scroll], nil, "blu"];
|
||||
me.C4 = [math.round(me.depAirport[0].runways[me.runways[2 + me.scroll]].length) ~ "M", nil, "blu"];
|
||||
me.R4 = ["CRS" ~ math.round(me.depAirport[0].runways[me.runways[2 + me.scroll]].heading), nil, "blu"];
|
||||
me.arrowsMatrix[0][3] = 1;
|
||||
me.arrowsColour[0][3] = "blu";
|
||||
}
|
||||
if (size(me.runways) >= 4) {
|
||||
me.L5 = [" " ~ me.runways[3], nil, "blu"];
|
||||
me.C5 = [math.round(me.depAirport[0].runways[me.runways[3]].length) ~ "M", nil, "blu"];
|
||||
me.R5 = ["CRS" ~ math.round(me.depAirport[0].runways[me.runways[3]].heading), nil, "blu"];
|
||||
me.L5 = [" " ~ me.runways[3 + me.scroll], nil, "blu"];
|
||||
me.C5 = [math.round(me.depAirport[0].runways[me.runways[3 + me.scroll]].length) ~ "M", nil, "blu"];
|
||||
me.R5 = ["CRS" ~ math.round(me.depAirport[0].runways[me.runways[3 + me.scroll]].heading), nil, "blu"];
|
||||
me.arrowsMatrix[0][4] = 1;
|
||||
me.arrowsColour[0][4] = "blu";
|
||||
}
|
||||
|
@ -126,9 +130,27 @@ var departurePage = {
|
|||
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
||||
}
|
||||
},
|
||||
scrollUp: func() {
|
||||
if (me.enableScroll) {
|
||||
me.scroll += 1;
|
||||
if (me.scroll > size(me.runways) - 4) {
|
||||
me.scroll = 0;
|
||||
}
|
||||
me.updateRunways();
|
||||
}
|
||||
},
|
||||
scrollDn: func() {
|
||||
if (me.enableScroll) {
|
||||
me.scroll -= 1;
|
||||
if (me.scroll < 0) {
|
||||
me.scroll = size(me.runways) - 4;
|
||||
}
|
||||
me.updateRunways();
|
||||
}
|
||||
},
|
||||
depPushbuttonLeft: func(index) {
|
||||
if (size(me.runways) >= (index - 1)) {
|
||||
me.selectedRunway = me.depAirport[0].runway(me.runways[index - 2]);
|
||||
me.selectedRunway = me.depAirport[0].runway(me.runways[index - 2 + me.scroll]);
|
||||
me.makeTmpy();
|
||||
fmgc.fp[me.computer].departure_runway = me.selectedRunway;
|
||||
me.updateActiveRunway();
|
||||
|
|
|
@ -18,10 +18,11 @@ var clearFPLNComputer = func {
|
|||
}
|
||||
|
||||
var StaticText = {
|
||||
new: func(computer, type) {
|
||||
new: func(computer, type, index = nil) {
|
||||
var in = {parents:[StaticText]};
|
||||
in.type = type;
|
||||
in.computer = computer;
|
||||
in.index = index;
|
||||
return in;
|
||||
},
|
||||
getText: func() {
|
||||
|
@ -45,7 +46,48 @@ var StaticText = {
|
|||
},
|
||||
type: nil,
|
||||
pushButtonLeft: func() {
|
||||
notAllowed(me.computer.mcdu);
|
||||
if (me.type != "discontinuity") {
|
||||
notAllowed(me.computer.mcdu);
|
||||
} else {
|
||||
var scratchpad = getprop("/MCDU[" ~ me.computer.mcdu ~ "]/scratchpad");
|
||||
if (TMPYActive[me.computer.mcdu].getBoolValue()) {
|
||||
if (scratchpad == "CLR") {
|
||||
if (fmgc.flightplan.deleteWP(me.index, me.computer.mcdu, 0) != 0) {
|
||||
notAllowed(me.computer.mcdu);
|
||||
} else {
|
||||
setprop("/MCDU[" ~ me.computer.mcdu ~ "]/scratchpad-msg", 0);
|
||||
setprop("/MCDU[" ~ me.computer.mcdu ~ "]/scratchpad", "");
|
||||
}
|
||||
} elsif (scratchpad == "") {
|
||||
if (canvas_mcdu.myLatRev[me.computer.mcdu] != nil) {
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu].del();
|
||||
}
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = nil;
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = latRev.new(4, "DISCON", me.index, me.computer.mcdu);
|
||||
setprop("/MCDU[" ~ me.computer.mcdu ~ "]/page", "LATREV");
|
||||
} else {
|
||||
notAllowed(me.computer.mcdu);
|
||||
}
|
||||
} else {
|
||||
if (scratchpad == "CLR") {
|
||||
if (fmgc.flightplan.deleteWP(me.index, 2, 0) != 0) {
|
||||
notAllowed(me.computer.mcdu);
|
||||
} else {
|
||||
setprop("/MCDU[" ~ me.computer.mcdu ~ "]/scratchpad-msg", 0);
|
||||
setprop("/MCDU[" ~ me.computer.mcdu ~ "]/scratchpad", "");
|
||||
}
|
||||
} elsif (scratchpad == "") {
|
||||
if (canvas_mcdu.myLatRev[me.computer.mcdu] != nil) {
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu].del();
|
||||
}
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = nil;
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = latRev.new(4, "DISCON", me.index, me.computer.mcdu);
|
||||
setprop("/MCDU[" ~ me.computer.mcdu ~ "]/page", "LATREV");
|
||||
} else {
|
||||
notAllowed(me.computer.mcdu);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
pushButtonRight: func() {
|
||||
notAllowed(me.computer.mcdu);
|
||||
|
@ -53,6 +95,7 @@ var StaticText = {
|
|||
};
|
||||
|
||||
var FPLNText = {
|
||||
_text: nil,
|
||||
new: func(computer, wp, dest, fp, wpIndex) {
|
||||
var in = {parents:[FPLNText]};
|
||||
in.wp = wp;
|
||||
|
@ -63,7 +106,12 @@ var FPLNText = {
|
|||
return in;
|
||||
},
|
||||
getText: func() {
|
||||
return me.wp.wp_name;
|
||||
me._text = split("-",me.wp.wp_name);
|
||||
if (size(me._text) == 2) {
|
||||
return me._text[0] ~ me._text[1];
|
||||
} else {
|
||||
return me._text[0];
|
||||
}
|
||||
},
|
||||
getColor: func(i) {
|
||||
if (TMPYActive[i].getBoolValue()) {
|
||||
|
@ -112,7 +160,16 @@ var FPLNText = {
|
|||
}
|
||||
} else {
|
||||
if (size(scratchpad) == 5) {
|
||||
var insertReturn = fmgc.flightplan.insertFix(scratchpad, me.index, me.computer.mcdu);
|
||||
var indexWp = fmgc.fp[me.computer.mcdu].indexOfWP(findFixesByID(scratchpad));
|
||||
if (indexWp == -1) {
|
||||
var insertReturn = fmgc.flightplan.insertFix(scratchpad, me.index, me.computer.mcdu);
|
||||
fmgc.fp[me.computer.mcdu].insertWP(createDiscontinuity(), me.index + 1);
|
||||
fmgc.flightplan.checkWPOutputs(me.computer.mcdu);
|
||||
} else {
|
||||
for (var i = me.index; i == indexWp; i = i + 1) {
|
||||
fmgc.flightplan.deleteWP(i, me.computer.mcdu, 0);
|
||||
}
|
||||
}
|
||||
if (insertReturn == 2) {
|
||||
notAllowed(me.computer.mcdu);
|
||||
} else if (insertReturn == 1) {
|
||||
|
@ -121,7 +178,16 @@ var FPLNText = {
|
|||
setprop("/MCDU[" ~ me.computer.mcdu ~ "]/scratchpad", "");
|
||||
}
|
||||
} else if (size(scratchpad) == 4) {
|
||||
var insertReturn = fmgc.flightplan.insertArpt(scratchpad, me.index, me.computer.mcdu);
|
||||
var indexWp = fmgc.fp[me.computer.mcdu].indexOfWP(findAirportsByICAO(scratchpad));
|
||||
if (indexWp == -1) {
|
||||
var insertReturn = fmgc.flightplan.insertArpt(scratchpad, me.index, me.computer.mcdu);
|
||||
fmgc.fp[me.computer.mcdu].insertWP(createDiscontinuity(), me.index + 1);
|
||||
fmgc.flightplan.checkWPOutputs(me.computer.mcdu);
|
||||
} else {
|
||||
for (var i = me.index; i == indexWp; i = i + 1) {
|
||||
fmgc.flightplan.deleteWP(i, me.computer.mcdu, 0);
|
||||
}
|
||||
}
|
||||
if (insertReturn == 2) {
|
||||
notAllowed(me.computer.mcdu);
|
||||
} else if (insertReturn == 1) {
|
||||
|
@ -130,7 +196,16 @@ var FPLNText = {
|
|||
setprop("/MCDU[" ~ me.computer.mcdu ~ "]/scratchpad", "");
|
||||
}
|
||||
} else if (size(scratchpad) == 3 or size(scratchpad) == 2) {
|
||||
var insertReturn = fmgc.flightplan.insertNavaid(scratchpad, me.index, me.computer.mcdu);
|
||||
var indexWp = fmgc.fp[me.computer.mcdu].indexOfWP(findNavaidsByID(scratchpad));
|
||||
if (indexWp == -1) {
|
||||
var insertReturn = fmgc.flightplan.insertNavaid(scratchpad, me.index, me.computer.mcdu);
|
||||
fmgc.fp[me.computer.mcdu].insertWP(createDiscontinuity(), me.index + 1);
|
||||
fmgc.flightplan.checkWPOutputs(me.computer.mcdu);
|
||||
} else {
|
||||
for (var i = me.index; i == indexWp; i = i + 1) {
|
||||
fmgc.flightplan.deleteWP(i, me.computer.mcdu, 0);
|
||||
}
|
||||
}
|
||||
if (insertReturn == 2) {
|
||||
notAllowed(me.computer.mcdu);
|
||||
} else if (insertReturn == 1) {
|
||||
|
@ -141,32 +216,61 @@ var FPLNText = {
|
|||
} else if (size(scratchpad) == 1) {
|
||||
formatError(me.computer.mcdu);
|
||||
} else if (scratchpad == "") {
|
||||
if (me.getText() == fmgc.fp[2].departure.id or left(me.getText(), 4) == fmgc.fp[2].departure.id) {
|
||||
if (canvas_mcdu.myLatRev[me.computer.mcdu] != nil) {
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu].del();
|
||||
if (!TMPYActive[me.computer.mcdu].getBoolValue()) {
|
||||
if (me.getText() == fmgc.fp[2].departure.id or left(me.getText(), 4) == fmgc.fp[2].departure.id) {
|
||||
if (canvas_mcdu.myLatRev[me.computer.mcdu] != nil) {
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu].del();
|
||||
}
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = nil;
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = latRev.new(0, me.getText(), me.index, me.computer.mcdu);
|
||||
} elsif (me.index == fmgc.arrivalAirportI[2]) {
|
||||
if (canvas_mcdu.myLatRev[me.computer.mcdu] != nil) {
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu].del();
|
||||
}
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = nil;
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = latRev.new(1, me.getText(), me.index, me.computer.mcdu);
|
||||
} elsif (me.index == (fmgc.currentWP[2] - 1)) {
|
||||
if (canvas_mcdu.myLatRev[me.computer.mcdu] != nil) {
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu].del();
|
||||
}
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = nil;
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = latRev.new(2, me.getText(), me.index, me.computer.mcdu);
|
||||
} else {
|
||||
if (canvas_mcdu.myLatRev[me.computer.mcdu] != nil) {
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu].del();
|
||||
}
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = nil;
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = latRev.new(3, me.getText(), me.index, me.computer.mcdu); # todo must not be available from lat lon / place - brg - dist / abeam etc
|
||||
}
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = nil;
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = latRev.new(0, me.getText());
|
||||
} elsif (me.index == fmgc.arrivalAirportI[2]) {
|
||||
if (canvas_mcdu.myLatRev[me.computer.mcdu] != nil) {
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu].del();
|
||||
}
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = nil;
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = latRev.new(1, me.getText());
|
||||
} elsif (me.index == (fmgc.currentWP[2] - 1)) {
|
||||
if (canvas_mcdu.myLatRev[me.computer.mcdu] != nil) {
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu].del();
|
||||
}
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = nil;
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = latRev.new(2, me.getText());
|
||||
setprop("/MCDU[" ~ me.computer.mcdu ~ "]/page", "LATREV");
|
||||
} else {
|
||||
if (canvas_mcdu.myLatRev[me.computer.mcdu] != nil) {
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu].del();
|
||||
if (me.getText() == fmgc.fp[me.computer.mcdu].departure.id or left(me.getText(), 4) == fmgc.fp[me.computer.mcdu].departure.id) {
|
||||
if (canvas_mcdu.myLatRev[me.computer.mcdu] != nil) {
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu].del();
|
||||
}
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = nil;
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = latRev.new(0, me.getText(), me.index, me.computer.mcdu);
|
||||
} elsif (me.index == fmgc.arrivalAirportI[me.computer.mcdu]) {
|
||||
if (canvas_mcdu.myLatRev[me.computer.mcdu] != nil) {
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu].del();
|
||||
}
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = nil;
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = latRev.new(1, me.getText(), me.index, me.computer.mcdu);
|
||||
} elsif (me.index == (fmgc.currentWP[2] - 1)) { # not a bug for PPOS
|
||||
if (canvas_mcdu.myLatRev[me.computer.mcdu] != nil) {
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu].del();
|
||||
}
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = nil;
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = latRev.new(2, me.getText(), me.index, me.computer.mcdu);
|
||||
} else {
|
||||
if (canvas_mcdu.myLatRev[me.computer.mcdu] != nil) {
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu].del();
|
||||
}
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = nil;
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = latRev.new(3, me.getText(), me.index, me.computer.mcdu); # todo must not be available from lat lon / place - brg - dist / abeam etc
|
||||
}
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = nil;
|
||||
canvas_mcdu.myLatRev[me.computer.mcdu] = latRev.new(3, me.getText());
|
||||
setprop("/MCDU[" ~ me.computer.mcdu ~ "]/page", "LATREV");
|
||||
}
|
||||
setprop("/MCDU[" ~ me.computer.mcdu ~ "]/page", "LATREV");
|
||||
} else {
|
||||
notAllowed(me.computer.mcdu);
|
||||
}
|
||||
|
@ -228,7 +332,12 @@ var FPLNLineComputer = {
|
|||
if (j == me.destIndex) {
|
||||
me.dest = 1;
|
||||
}
|
||||
append(me.planList, FPLNText.new(me, fpln.getWP(j), me.dest, fplnID, j));
|
||||
var wpt = fpln.getWP(j);
|
||||
if (wpt.wp_name == "DISCONTINUITY") {
|
||||
append(me.planList, StaticText.new(me, "discontinuity", j));
|
||||
} else {
|
||||
append(me.planList, FPLNText.new(me, fpln.getWP(j), me.dest, fplnID, j));
|
||||
}
|
||||
}
|
||||
if (debug == 1) printf("%d: dest is: %s", me.mcdu, fpln.getWP(me.destIndex).wp_name);
|
||||
}
|
||||
|
|
|
@ -18,16 +18,31 @@ var latRev = {
|
|||
R6: [nil, nil, "ack"],
|
||||
depAirport: nil,
|
||||
arrAirport: nil,
|
||||
new: func(type, id) {
|
||||
index: nil,
|
||||
computer: 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
|
||||
lr.type = type; # 0 = origin 1 = destination 2 = ppos (from waypoint) 3 = generic wpt, 4 = discon
|
||||
lr.id = id;
|
||||
lr.index = index;
|
||||
lr.computer = computer;
|
||||
lr._setupPageWithData();
|
||||
lr._checkTmpy();
|
||||
return lr;
|
||||
},
|
||||
del: func() {
|
||||
return nil;
|
||||
},
|
||||
_checkTmpy: func() {
|
||||
if (TMPYActive[me.computer].getBoolValue()) {
|
||||
me.L6 = [" F-PLN", " TMPY", "yel"];
|
||||
me.arrowsColour[0][5] = "yel";
|
||||
me.R2[2] = "yel";
|
||||
me.R3[2] = "yel";
|
||||
me.R4[2] = "yel";
|
||||
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
||||
}
|
||||
},
|
||||
_setupPageWithData: func() {
|
||||
if (me.type == 2) {
|
||||
me.title = ["LAT REV", " FROM ", "PPOS"];
|
||||
|
@ -39,6 +54,14 @@ var latRev = {
|
|||
me.arrowsMatrix = [[0, 1, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0]];
|
||||
me.arrowsColour = [["ack", "wht", "wht", "ack", "ack", "wht"], ["wht", "ack", "ack", "ack", "ack", "ack"]];
|
||||
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0]];
|
||||
} elsif (me.type == 4) {
|
||||
me.title = ["LAT REV", " FROM ", "DISCON"];
|
||||
me.R3 = ["[ ]", "NEXT WPT ", "blu"];
|
||||
me.R4 = ["[ ]", "NEW DEST", "blu"];
|
||||
me.L6 = [" RETURN", nil, "wht"];
|
||||
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]];
|
||||
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]];
|
||||
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0]];
|
||||
} else {
|
||||
me.title = ["LAT REV", " FROM ", me.id];
|
||||
|
||||
|
@ -54,7 +77,7 @@ var latRev = {
|
|||
me.L6 = [" RETURN", nil, "wht"];
|
||||
me.R1 = ["FIX INFO ", nil, "wht"];
|
||||
me.R2 = ["[ ]°/[ ]°/[ ]", "LL XING/INCR/NO", "blu"];
|
||||
me.R3 = ["[ ]", "NEXT WPT ", "blu"];
|
||||
me.R3 = ["[ ]", "NEXT WPT ", "blu"];
|
||||
me.R4 = ["[ ]", "NEW DEST", "blu"];
|
||||
me.arrowsMatrix = [[1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0]];
|
||||
me.arrowsColour = [["wht", "wht", "ack", "ack", "ack", "wht"], ["wht", "ack", "ack", "ack", "ack", "ack"]];
|
||||
|
@ -70,7 +93,7 @@ var latRev = {
|
|||
me.L4 = [" ALTN", " ENABLE", "blu"];
|
||||
me.L6 = [" RETURN", nil, "wht"];
|
||||
me.R1 = ["ARRIVAL ", nil, "wht"];
|
||||
me.R3 = ["[ ]", "NEXT WPT ", "blu"];
|
||||
me.R3 = ["[ ]", "NEXT WPT ", "blu"];
|
||||
me.arrowsMatrix = [[0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0]];
|
||||
me.arrowsColour = [["ack", "ack", "wht", "blu", "ack", "wht"], ["wht", "ack", "ack", "ack", "ack", "ack"]];
|
||||
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0]];
|
||||
|
@ -87,7 +110,7 @@ var latRev = {
|
|||
me.L4 = [" ALTN", " ENABLE", "blu"];
|
||||
me.L6 = [" RETURN", nil, "wht"];
|
||||
me.R1 = ["FIX INFO ", nil, "wht"];
|
||||
me.R3 = ["[ ]", "NEXT WPT ", "blu"];
|
||||
me.R3 = ["[ ]", "NEXT WPT ", "blu"];
|
||||
me.R4 = ["[ ]", "NEW DEST", "blu"];
|
||||
me.R5 = ["AIRWAYS ", nil, "wht"];
|
||||
me.arrowsMatrix = [[0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 1, 0]];
|
||||
|
@ -96,6 +119,83 @@ var latRev = {
|
|||
}
|
||||
}
|
||||
},
|
||||
makeTmpy: func() {
|
||||
if (!TMPYActive[me.computer].getBoolValue()) {
|
||||
fmgc.flightplan.initTempFP(me.computer, 2);
|
||||
me._checkTmpy();
|
||||
}
|
||||
},
|
||||
nextWpt: func() {
|
||||
me.makeTmpy();
|
||||
me.R3 = [getprop("/MCDU[" ~ me.computer ~ "]/scratchpad"), "NEXT WPT ", "yel"];
|
||||
me.fontMatrix[1][2] = 0;
|
||||
|
||||
# check if it is part of the active f-pln, if so delete intermediate wpts, if not create discontinuiity after it with original wpts
|
||||
if (size(me.R3[0]) == 5) {
|
||||
var fix = findFixesByID(me.R3[0]);
|
||||
if (fix != nil) {
|
||||
var indexWp = fmgc.fp[me.computer].indexOfWP(fix[0]);
|
||||
if (indexWp == -1) {
|
||||
var _insert = fmgc.flightplan.insertFix(me.R3[0], me.index + 1, me.computer);
|
||||
fmgc.fp[me.computer].insertWP(createDiscontinuity(), me.index + 2);
|
||||
fmgc.flightplan.checkWPOutputs(me.computer);
|
||||
} else {
|
||||
for (var i = me.index + 1; i == indexWp; i = i + 1) {
|
||||
fmgc.flightplan.deleteWP(i, me.computer, 0);
|
||||
}
|
||||
var _insert = fmgc.flightplan.insertFix(me.R3[0], me.index + 1, me.computer);
|
||||
}
|
||||
} else {
|
||||
var _insert = 1;
|
||||
}
|
||||
} elsif (size(me.R3[0]) == 4) {
|
||||
var airport = findAirportsByICAO(me.R3[0]);
|
||||
if (airport != nil) {
|
||||
var indexWp = fmgc.fp[me.computer].indexOfWP(fix[0]);
|
||||
if (indexWp == -1) {
|
||||
var _insert = fmgc.flightplan.insertArpt(me.R3[0], me.index + 1, me.computer);
|
||||
fmgc.fp[me.computer].insertWP(createDiscontinuity(), me.index + 2);
|
||||
fmgc.flightplan.checkWPOutputs(me.computer);
|
||||
} else {
|
||||
for (var i = me.index + 1; i == indexWp; i = i + 1) {
|
||||
fmgc.flightplan.deleteWP(i, me.computer, 0);
|
||||
}
|
||||
var _insert = fmgc.flightplan.insertArpt(me.R3[0], me.index + 1, me.computer);
|
||||
}
|
||||
} else {
|
||||
var _insert = 1;
|
||||
}
|
||||
} elsif (size(me.R3[0]) == 3 or size(me.R3[0]) == 2) {
|
||||
var navaid = findNavaidsByID(me.R3[0]);
|
||||
if (navaid != nil) {
|
||||
var indexWp = fmgc.fp[me.computer].indexOfWP(navaid[0]);
|
||||
if (indexWp == -1) {
|
||||
var _insert = fmgc.flightplan.insertNavaid(me.R3[0], me.index + 1, me.computer);
|
||||
fmgc.fp[me.computer].insertWP(createDiscontinuity(), me.index + 2);
|
||||
fmgc.flightplan.checkWPOutputs(me.computer);
|
||||
} else {
|
||||
for (var i = me.index + 1; i == indexWp; i = i + 1) {
|
||||
fmgc.flightplan.deleteWP(i, me.computer, 0);
|
||||
}
|
||||
var _insert = fmgc.flightplan.insertNavaid(me.R3[0], me.index + 1, me.computer);
|
||||
}
|
||||
} else {
|
||||
var _insert = 1;
|
||||
}
|
||||
} else {
|
||||
formatError(me.computer);
|
||||
}
|
||||
|
||||
if (_insert == 1) {
|
||||
notInDataBase(me.computer);
|
||||
} elsif (_insert == 2) {
|
||||
notAllowed(me.computer);
|
||||
} else {
|
||||
setprop("/MCDU[" ~ me.computer ~ "]/scratchpad", "");
|
||||
fmgc.flightplan.checkWPOutputs(me.computer);
|
||||
setprop("/MCDU[" ~ me.computer ~ "]/page", "F-PLNA");
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
var dmsToString = func(dms, type) {
|
||||
|
|
|
@ -270,6 +270,12 @@ var rskbutton = func(btn, i) {
|
|||
printInput("R3", i);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
|
||||
printInput2("R3", i);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "LATREV") {
|
||||
if (canvas_mcdu.myLatRev[i].type != 2) {
|
||||
canvas_mcdu.myLatRev[i].nextWpt();
|
||||
} else {
|
||||
notAllowed(i);
|
||||
}
|
||||
} else {
|
||||
notAllowed(i);
|
||||
}
|
||||
|
@ -372,10 +378,14 @@ var arrowbutton = func(btn, i) {
|
|||
} else if (btn == "up") {
|
||||
if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") {
|
||||
slewFPLN(1, i);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
|
||||
canvas_mcdu.myDeparture[i].scrollUp();
|
||||
}
|
||||
} else if (btn == "down") {
|
||||
if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") {
|
||||
slewFPLN(-1, i);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
|
||||
canvas_mcdu.myDeparture[i].scrollDn();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,6 +227,7 @@ var systemsInit = func {
|
|||
|
||||
setlistener("/sim/signals/fdm-initialized", func {
|
||||
systemsInit();
|
||||
fmgc.outputPropsTimer.start();
|
||||
});
|
||||
|
||||
var systemsLoop = maketimer(0.1, func {
|
||||
|
|
Loading…
Add table
Reference in a new issue