Torsten Brehm: catch NaNs in pilot list gui, and report only once per call-sign.
This commit is contained in:
parent
e7e8ac84f2
commit
0425ec0589
1 changed files with 23 additions and 13 deletions
|
@ -178,6 +178,7 @@ var dialog = {
|
|||
{ type: "checkbox", property: "controls/invisible", callback: "multiplayer.dialog.toggle_ignore",
|
||||
argprop: "callsign", label: "---------", halign: "right", font: font },
|
||||
];
|
||||
me.cs_warnings = {};
|
||||
me.name = "who-is-online";
|
||||
me.dialog = nil;
|
||||
me.loopid = 0;
|
||||
|
@ -275,20 +276,29 @@ var dialog = {
|
|||
var ac = geo.Coord.new().set_xyz(x, y, z);
|
||||
var distance = nil;
|
||||
call(func distance = self.distance_to(ac), nil, var err = []);
|
||||
if (size(err)) {
|
||||
# debug.printerror(err);
|
||||
# debug.dump(self, ac, mp);
|
||||
# debug.tree(mp.node);
|
||||
if ((size(err))or(distance==nil)) {
|
||||
# Oops, have errors. Bogus position data (and distance==nil).
|
||||
if (me.cs_warnings[mp.callsign]!=1) {
|
||||
# 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)
|
||||
settimer(func me.update(id), 1, 1);
|
||||
|
|
Loading…
Reference in a new issue