Merge branch 'master' of gitorious.org:fg/fgdata into Work
This commit is contained in:
commit
179e935625
2 changed files with 161 additions and 18 deletions
|
@ -178,6 +178,7 @@ var dialog = {
|
||||||
{ type: "checkbox", property: "controls/invisible", callback: "multiplayer.dialog.toggle_ignore",
|
{ type: "checkbox", property: "controls/invisible", callback: "multiplayer.dialog.toggle_ignore",
|
||||||
argprop: "callsign", label: "---------", halign: "right", font: font },
|
argprop: "callsign", label: "---------", halign: "right", font: font },
|
||||||
];
|
];
|
||||||
|
me.cs_warnings = {};
|
||||||
me.name = "who-is-online";
|
me.name = "who-is-online";
|
||||||
me.dialog = nil;
|
me.dialog = nil;
|
||||||
me.loopid = 0;
|
me.loopid = 0;
|
||||||
|
@ -275,20 +276,29 @@ var dialog = {
|
||||||
var ac = geo.Coord.new().set_xyz(x, y, z);
|
var ac = geo.Coord.new().set_xyz(x, y, z);
|
||||||
var distance = nil;
|
var distance = nil;
|
||||||
call(func distance = self.distance_to(ac), nil, var err = []);
|
call(func distance = self.distance_to(ac), nil, var err = []);
|
||||||
if (size(err)) {
|
if ((size(err))or(distance==nil)) {
|
||||||
# debug.printerror(err);
|
# Oops, have errors. Bogus position data (and distance==nil).
|
||||||
# debug.dump(self, ac, mp);
|
if (me.cs_warnings[mp.callsign]!=1) {
|
||||||
# debug.tree(mp.node);
|
# report each callsign once only (avoid cluttering)
|
||||||
|
me.cs_warnings[mp.callsign] = 1;
|
||||||
|
print("Received invalid position data: " ~ debug._error(mp.callsign));
|
||||||
|
}
|
||||||
|
# debug.printerror(err);
|
||||||
|
# debug.dump(self, ac, mp);
|
||||||
|
# debug.tree(mp.node);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# Node with valid position data (and "distance!=nil").
|
||||||
|
n.setValues({
|
||||||
|
"model-short": mp.available ? mp.model : "[" ~ mp.model ~ "]",
|
||||||
|
"bearing-to": self.course_to(ac),
|
||||||
|
"distance-to-km": distance / 1000.0,
|
||||||
|
"distance-to-nm": distance * M2NM,
|
||||||
|
"position/altitude-m": n.getNode("position/altitude-ft").getValue() * FT2M,
|
||||||
|
"controls/invisible": contains(ignore, mp.callsign),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
n.setValues({
|
|
||||||
"model-short": mp.available ? mp.model : "[" ~ mp.model ~ "]",
|
|
||||||
"bearing-to": self.course_to(ac),
|
|
||||||
"distance-to-km": distance / 1000.0,
|
|
||||||
"distance-to-nm": distance * M2NM,
|
|
||||||
"position/altitude-m": n.getNode("position/altitude-ft").getValue() * FT2M,
|
|
||||||
"controls/invisible": contains(ignore, mp.callsign),
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
if (PILOTSDLG_RUNNING)
|
if (PILOTSDLG_RUNNING)
|
||||||
settimer(func me.update(id), 1, 1);
|
settimer(func me.update(id), 1, 1);
|
||||||
|
|
|
@ -30,6 +30,8 @@ command interface /autopilot/route-manager/input:
|
||||||
var list = cmdarg().getNode("list");
|
var list = cmdarg().getNode("list");
|
||||||
var cmd = routem.getNode("input", 1);
|
var cmd = routem.getNode("input", 1);
|
||||||
var route = routem.getNode("route", 1);
|
var route = routem.getNode("route", 1);
|
||||||
|
var dep = routem.getNode("departure", 1);
|
||||||
|
var dest = routem.getNode("destination", 1);
|
||||||
|
|
||||||
var sel_index = func {
|
var sel_index = func {
|
||||||
return int(selection.getValue());
|
return int(selection.getValue());
|
||||||
|
@ -59,8 +61,8 @@ command interface /autopilot/route-manager/input:
|
||||||
cmd.setValue("@delete" ~ sel_index());
|
cmd.setValue("@delete" ~ sel_index());
|
||||||
}
|
}
|
||||||
|
|
||||||
var auto_route = func {
|
var route = func {
|
||||||
cmd.setValue();
|
cmd.setValue("@route" ~ sel_index());
|
||||||
}
|
}
|
||||||
|
|
||||||
var jump_to = func {
|
var jump_to = func {
|
||||||
|
@ -88,10 +90,15 @@ command interface /autopilot/route-manager/input:
|
||||||
|
|
||||||
var departureRunways = dlg.getNode("departure-runways", 1);
|
var departureRunways = dlg.getNode("departure-runways", 1);
|
||||||
var destRunways = dlg.getNode("destination-runways", 1);
|
var destRunways = dlg.getNode("destination-runways", 1);
|
||||||
|
var sids = dlg.getNode("sids", 1);
|
||||||
|
var stars = dlg.getNode("stars", 1);
|
||||||
|
|
||||||
var updateRunways = func {
|
var updateRunways = func {
|
||||||
var depIcao = routem.getNode("departure").getNode("airport").getValue();
|
var depIcao = dep.getNode("airport").getValue();
|
||||||
departureRunways.removeChildren("value");
|
departureRunways.removeChildren("value");
|
||||||
|
|
||||||
|
var currentRunway = dep.getNode("runway").getValue();
|
||||||
|
var foundCurrent = 0;
|
||||||
|
|
||||||
var apt = airportinfo(depIcao);
|
var apt = airportinfo(depIcao);
|
||||||
if (apt != nil) {
|
if (apt != nil) {
|
||||||
|
@ -99,11 +106,20 @@ command interface /autopilot/route-manager/input:
|
||||||
foreach (var rwy; keys(apt.runways)) {
|
foreach (var rwy; keys(apt.runways)) {
|
||||||
departureRunways.getNode("value[" ~ i ~ "]", 1).setValue(rwy);
|
departureRunways.getNode("value[" ~ i ~ "]", 1).setValue(rwy);
|
||||||
i += 1;
|
i += 1;
|
||||||
|
if (rwy == currentRunway) {
|
||||||
|
foundCurrent = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var destIcao = routem.getNode("destination").getNode("airport").getValue();
|
if (!foundCurrent) {
|
||||||
|
dep.getNode("runway").clearValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
var destIcao = dest.getNode("airport").getValue();
|
||||||
destRunways.removeChildren("value");
|
destRunways.removeChildren("value");
|
||||||
|
currentRunway = dest.getNode("runway").getValue();
|
||||||
|
foundCurrent = 0;
|
||||||
|
|
||||||
var apt = airportinfo(destIcao);
|
var apt = airportinfo(destIcao);
|
||||||
if (apt != nil) {
|
if (apt != nil) {
|
||||||
|
@ -111,11 +127,68 @@ command interface /autopilot/route-manager/input:
|
||||||
foreach (var rwy; keys(apt.runways)) {
|
foreach (var rwy; keys(apt.runways)) {
|
||||||
destRunways.getNode("value[" ~ i ~ "]", 1).setValue(rwy);
|
destRunways.getNode("value[" ~ i ~ "]", 1).setValue(rwy);
|
||||||
i += 1;
|
i += 1;
|
||||||
|
if (rwy == currentRunway) {
|
||||||
|
foundCurrent = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!foundCurrent) {
|
||||||
|
dest.getNode("runway").clearValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
print("updated runways");
|
||||||
gui.dialog_update("route-manager");
|
gui.dialog_update("route-manager");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var updateSIDs = func {
|
||||||
|
sids.removeChildren("value");
|
||||||
|
var depIcao = dep.getNode("airport").getValue();
|
||||||
|
var rwy = dep.getNode("runway").getValue();
|
||||||
|
var apt = airportinfo(depIcao);
|
||||||
|
if (apt == nil or apt.runways[rwy] == nil) {
|
||||||
|
dep.getNode("sid").clearValue();
|
||||||
|
gui.dialog_update("route-manager", "sid");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sids.getNode("value[0]", 1).setValue("(none)");
|
||||||
|
var i=1;
|
||||||
|
foreach (var s; apt.runways[rwy].sids) {
|
||||||
|
sids.getNode("value[" ~ i ~ "]", 1).setValue(s);
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
gui.dialog_update("route-manager", "sid");
|
||||||
|
}
|
||||||
|
|
||||||
|
var updateSTARs = func {
|
||||||
|
stars.removeChildren("value");
|
||||||
|
var icao = dest.getNode("airport").getValue();
|
||||||
|
var rwy = dest.getNode("runway").getValue();
|
||||||
|
var apt = airportinfo(icao);
|
||||||
|
if (apt == nil or apt.runways[rwy] == nil) {
|
||||||
|
dest.getNode("star").clearValue();
|
||||||
|
gui.dialog_update("route-manager", "star");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var i=1;
|
||||||
|
stars.getNode("value[0]", 1).setValue("(none)");
|
||||||
|
foreach (var s; apt.runways[rwy].stars) {
|
||||||
|
stars.getNode("value[" ~ i ~ "]", 1).setValue(s);
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
gui.dialog_update("route-manager", "star");
|
||||||
|
}
|
||||||
|
|
||||||
|
# initialise departure values based on current position
|
||||||
|
cmd.setValue("@posinit");
|
||||||
|
|
||||||
|
updateRunways();
|
||||||
|
updateSIDs();
|
||||||
|
updateSTARs();
|
||||||
</open>
|
</open>
|
||||||
|
|
||||||
<close>
|
<close>
|
||||||
|
@ -189,6 +262,31 @@ command interface /autopilot/route-manager/input:
|
||||||
<property>/autopilot/route-manager/departure/runway</property>
|
<property>/autopilot/route-manager/departure/runway</property>
|
||||||
<editable>false</editable>
|
<editable>false</editable>
|
||||||
<properties>/sim/gui/dialogs/route-manager/departure-runways</properties>
|
<properties>/sim/gui/dialogs/route-manager/departure-runways</properties>
|
||||||
|
|
||||||
|
<binding>
|
||||||
|
<command>dialog-apply</command>
|
||||||
|
<object-name>departure-runway</object-name>
|
||||||
|
</binding>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>updateSIDs();</script>
|
||||||
|
</binding>
|
||||||
|
</combo>
|
||||||
|
|
||||||
|
<text>
|
||||||
|
<label>SID:</label>
|
||||||
|
</text>
|
||||||
|
<combo>
|
||||||
|
<name>sid</name>
|
||||||
|
<pref-width>100</pref-width>
|
||||||
|
<property>/autopilot/route-manager/departure/sid</property>
|
||||||
|
<editable>false</editable>
|
||||||
|
<properties>/sim/gui/dialogs/route-manager/sids</properties>
|
||||||
|
|
||||||
|
<binding>
|
||||||
|
<command>dialog-apply</command>
|
||||||
|
<object-name>sid</object-name>
|
||||||
|
</binding>
|
||||||
</combo>
|
</combo>
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
|
@ -229,6 +327,32 @@ command interface /autopilot/route-manager/input:
|
||||||
<property>/autopilot/route-manager/destination/runway</property>
|
<property>/autopilot/route-manager/destination/runway</property>
|
||||||
<editable>false</editable>
|
<editable>false</editable>
|
||||||
<properties>/sim/gui/dialogs/route-manager/destination-runways</properties>
|
<properties>/sim/gui/dialogs/route-manager/destination-runways</properties>
|
||||||
|
|
||||||
|
<binding>
|
||||||
|
<command>dialog-apply</command>
|
||||||
|
<object-name>destination-runway</object-name>
|
||||||
|
</binding>
|
||||||
|
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>updateSTARs();</script>
|
||||||
|
</binding>
|
||||||
|
</combo>
|
||||||
|
|
||||||
|
<text>
|
||||||
|
<label>STAR:</label>
|
||||||
|
</text>
|
||||||
|
<combo>
|
||||||
|
<name>star</name>
|
||||||
|
<pref-width>100</pref-width>
|
||||||
|
<property>/autopilot/route-manager/destination/star</property>
|
||||||
|
<editable>false</editable>
|
||||||
|
<properties>/sim/gui/dialogs/route-manager/stars</properties>
|
||||||
|
|
||||||
|
<binding>
|
||||||
|
<command>dialog-apply</command>
|
||||||
|
<object-name>star</object-name>
|
||||||
|
</binding>
|
||||||
</combo>
|
</combo>
|
||||||
</group>
|
</group>
|
||||||
<!--
|
<!--
|
||||||
|
@ -341,6 +465,7 @@ command interface /autopilot/route-manager/input:
|
||||||
<pref-width>70</pref-width>
|
<pref-width>70</pref-width>
|
||||||
<binding>
|
<binding>
|
||||||
<command>dialog-apply</command>
|
<command>dialog-apply</command>
|
||||||
|
<object-name>input</object-name>
|
||||||
</binding>
|
</binding>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
|
@ -389,6 +514,14 @@ command interface /autopilot/route-manager/input:
|
||||||
<script>remove()</script>
|
<script>remove()</script>
|
||||||
</binding>
|
</binding>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<button>
|
||||||
|
<legend>Route</legend>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>route()</script>
|
||||||
|
</binding>
|
||||||
|
</button>
|
||||||
<!--
|
<!--
|
||||||
<button>
|
<button>
|
||||||
<legend>Auto-route</legend>
|
<legend>Auto-route</legend>
|
||||||
|
|
Loading…
Reference in a new issue