From 56859113b29e34d3ed7ab55a3646713197115584 Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Mon, 10 Jun 2019 14:19:07 +0100 Subject: [PATCH] Nasal/multiplayer.nas: added column showing whether we've found and loaded -set.xml for each multiplayer. This determines whether multiplayer views work correctly - these require correct view offsets from the -set.xml files. --- Nasal/multiplayer.nas | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Nasal/multiplayer.nas b/Nasal/multiplayer.nas index b47b71669..5adb09856 100644 --- a/Nasal/multiplayer.nas +++ b/Nasal/multiplayer.nas @@ -183,12 +183,13 @@ var dialog = { slant: getprop("/sim/gui/selected-style/fonts/mp-list/slant") or 0, }; - me.header = ["chat", " callsign"," code"," model", " brg", func dialog.dist_hdr, func dialog.alt_hdr ~ " ", "ver", "ignore" ~ " "]; + me.header = ["chat", " callsign"," code"," model", " set", " brg", func dialog.dist_hdr, func dialog.alt_hdr ~ " ", "ver", "ignore" ~ " "]; me.columns = [ { type: "button", legend: "", halign: "right", callback: "multiplayer.compose_message", "pref-height": 14, "pref-width": 14 }, { type: "text", property: "callsign", format: " %s", label: "-----------", halign: "fill" , font: me.font }, { type: "text", property: "id-code", format: " %s", label: "-----", halign: "fill" , font: me.font }, { type: "text", property: "model-short", format: " %s", label: "--------------", halign: "fill" , font: me.font }, + { type: "text", property: "set-loaded", format: "%s", label: "----", halign: "fill" , font: me.font }, { type: "text", property: "bearing-to", format: " %3.0f", label: "----", halign: "right", font: me.font }, { type: "text", property: func dialog.dist_node, format:" %8.2f", label: "---------", halign: "right", font: me.font }, { type: "text", property: func dialog.alt_node, format:" %7.0f", label: "---------", halign: "right", font: me.font }, @@ -341,8 +342,19 @@ w.node.setValues({ "font" : me.font}); else { # Node with valid position data (and "distance!=nil"). + + # For 'set-loaded' column, we find whether the 'set' has more + # than just the 'sim' child (which we always create even if + # we couldn't load the -set.xml, in order to provide default + # values for views' config/z-offset-m values). + var set = n.getNode("set"); + var set_numchildren = 0; + if (set != nil) set_numchildren = size(set.getChildren()); + var set_loaded = (set_numchildren >= 2); + n.setValues({ "model-short": n.getNode("model-installed").getValue() ? mp.model : "[" ~ mp.model ~ "]", + "set-loaded": set_loaded ? " *" : " ", "bearing-to": self.course_to(ac), "distance-to-km": distance / 1000.0, "distance-to-nm": distance * M2NM,