Merge branch 'dev' into 3D
This commit is contained in:
commit
4f77deb971
3 changed files with 84 additions and 16 deletions
|
@ -270,7 +270,7 @@ var SimbriefParser = {
|
|||
fmgc.FMGCInternal.costIndex = me.OFP.getNode("general/costindex").getValue();
|
||||
fmgc.FMGCInternal.costIndexSet = 1;
|
||||
fmgc.FMGCNodes.costIndex.setValue(fmgc.FMGCInternal.costIndex);
|
||||
fmgc.FMGCInternal.tropo = me.OFP.getNode("general/avg_tropopause").getValue();
|
||||
fmgc.FMGCInternal.tropo = math.round(me.OFP.getNode("general/avg_tropopause").getValue(), 10);
|
||||
fmgc.FMGCInternal.tropoSet = 1;
|
||||
|
||||
# Set cruise altitude
|
||||
|
|
|
@ -310,27 +310,65 @@ var initInputA = func(key, i) {
|
|||
setprop("MCDU[" ~ i ~ "]/page", "WINDCLB");
|
||||
} else if (key == "R5") {
|
||||
if (scratchpad == "CLR") {
|
||||
if (fmgc.FMGCInternal.tropoSet) {
|
||||
fmgc.FMGCInternal.tropo = 36090;
|
||||
fmgc.FMGCInternal.tropoSet = 0;
|
||||
mcdu_scratchpad.scratchpads[i].empty();
|
||||
} else {
|
||||
var tropo = size(scratchpad);
|
||||
if (tropo == 5 and scratchpad <= 99990) {
|
||||
fmgc.FMGCInternal.tropo = scratchpad;
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
} else {
|
||||
if (num(scratchpad) == nil) {
|
||||
if (find("FL", scratchpad) != -1) {
|
||||
var tropos = size(split("FL", scratchpad)[1]);
|
||||
var tropon = num(split("FL", scratchpad)[1]);
|
||||
if (tropon != nil) {
|
||||
if ((tropos == 2 or tropos == 3) and tropon >= 10 and tropon <= 999) {
|
||||
fmgc.FMGCInternal.tropo = tropon * 100;
|
||||
fmgc.FMGCInternal.tropoSet = 1;
|
||||
mcdu_scratchpad.scratchpads[i].empty();
|
||||
} else {
|
||||
mcdu_message(i, "ENTRY OUT OF RANGE");
|
||||
}
|
||||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
} else {
|
||||
var tropos = size(scratchpad);
|
||||
var tropon = num(scratchpad);
|
||||
if ((tropos == 4 or tropos == 5) and tropon >= 1000 and tropon <= 99990) {
|
||||
fmgc.FMGCInternal.tropo = math.round(tropon, 10);
|
||||
fmgc.FMGCInternal.tropoSet = 1;
|
||||
mcdu_scratchpad.scratchpads[i].empty();
|
||||
} else if ((tropos == 2 or tropos == 3) and tropon >= 10 and tropon <= 999) {
|
||||
fmgc.FMGCInternal.tropo = num(scratchpad) * 100;
|
||||
fmgc.FMGCInternal.tropoSet = 1;
|
||||
mcdu_scratchpad.scratchpads[i].empty();
|
||||
} else {
|
||||
mcdu_message(i, "ENTRY OUT OF RANGE");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (key == "R6") {
|
||||
if (scratchpad == "CLR") {
|
||||
if (fmgc.FMGCInternal.gndTempSet) {
|
||||
fmgc.FMGCInternal.gndTempSet = 0;
|
||||
fmgc.FMGCInternal.gndTemp = 15;
|
||||
mcdu_scratchpad.scratchpads[i].empty();
|
||||
} else if (int(scratchpad) != nil and fmgc.FMGCInternal.phase == 0 and size(scratchpad) >= 1 and size(scratchpad) <= 3 and scratchpad >= -99 and scratchpad <= 99) {
|
||||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
} else if (isnum(scratchpad) and fmgc.FMGCInternal.phase == 0) {
|
||||
if (size(scratchpad) >= 1 and size(scratchpad) <= 3 and scratchpad >= -99 and scratchpad <= 99) {
|
||||
fmgc.FMGCInternal.gndTemp = scratchpad;
|
||||
fmgc.FMGCInternal.gndTempSet = 1;
|
||||
mcdu_scratchpad.scratchpads[i].empty();
|
||||
} else {
|
||||
mcdu_message(i, "ENTRY OUT OF RANGE");
|
||||
}
|
||||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
|
|
|
@ -340,6 +340,7 @@ var ATIS = {
|
|||
print("Failed to parse ATIS for " ~ airport);
|
||||
debug.dump(r.response);
|
||||
debug.printerror(errs);
|
||||
me.sent = 0;
|
||||
mcdu.mcdu_message(i, "BAD SERVER RESPONSE");
|
||||
}
|
||||
});
|
||||
|
@ -391,6 +392,14 @@ var ATIS = {
|
|||
code = split(".", code)[0];
|
||||
}
|
||||
|
||||
if (find(",", code) != -1) {
|
||||
code = split(",", code)[0];
|
||||
}
|
||||
|
||||
if (size(code) > 1) {
|
||||
code = left(code, 1);
|
||||
}
|
||||
|
||||
me.receivedCode = code;
|
||||
|
||||
var time = "";
|
||||
|
@ -403,26 +412,47 @@ var ATIS = {
|
|||
} else if (find("TIME ", raw) != -1) {
|
||||
time = split("TIME ", raw)[1];
|
||||
time = split(" ", time)[0];
|
||||
} else if (find("WEATHER AT ", raw) != -1) {
|
||||
time = split("WEATHER AT ", raw)[1];
|
||||
time = left(split(" ", time)[0], 4);
|
||||
} else if (find(" UTC", raw) != -1) {
|
||||
time = split(" UTC", raw)[0];
|
||||
time = right(time, 4);
|
||||
} else if (find("Z.", raw) != -1) {
|
||||
time = split("Z.", raw)[0];
|
||||
time = right(time, 4);
|
||||
} else if (find("Z SPECIAL", raw) != -1) {
|
||||
time = split("Z SPECIAL", raw)[0];
|
||||
time = right(time, 4);
|
||||
} else if (find("Z EXPECT", raw) != -1) {
|
||||
time = split("Z EXPECT", raw)[0];
|
||||
time = right(time, 4);
|
||||
} else if (find("metreport", raw) != -1) {
|
||||
time = split("metreport", raw)[0];
|
||||
time = right(time, 4);
|
||||
} else if (find("METREPORT ", raw) != -1) {
|
||||
time = split("METREPORT ", raw)[1];
|
||||
time = left(time, 4);
|
||||
} else if (find("INFORMATION " ~ code ~ " AT ", raw) != -1) {
|
||||
time = split("INFORMATION " ~ code ~ " AT ", raw)[1];
|
||||
time = left(time, 4);
|
||||
} else if (find((code ~ " "), raw) != -1) {
|
||||
if (size(split(" ",split(code ~ " ", raw)[1])[0]) == 4) {
|
||||
time = split(" ",split(code ~ " ", raw)[1])[0];
|
||||
}
|
||||
} else if (size(split(" ",split(code, raw)[1])[0]) == 4) {
|
||||
time = split(" ",split(code, raw)[1])[0];
|
||||
} else {
|
||||
print("Failed to find a valid ATIS time for " ~ me.station);
|
||||
debug.dump(raw);
|
||||
}
|
||||
|
||||
# Handle UK airport issue
|
||||
# Limitation: always ends in 0
|
||||
if (size(time) == 3) {
|
||||
time ~= " ";
|
||||
time ~= "0";
|
||||
} else if (size(time) > 4) {
|
||||
time = left(time, 4);
|
||||
}
|
||||
|
||||
raw = string.uc(raw);
|
||||
|
|
Loading…
Reference in a new issue