From 24204e2e7517d46efec780bddb4bc5086a7e1206 Mon Sep 17 00:00:00 2001 From: torsten Date: Sat, 5 Sep 2009 20:22:14 +0000 Subject: [PATCH] don't ignore the latest multiplayer pilot --- Nasal/multiplayer.nas | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Nasal/multiplayer.nas b/Nasal/multiplayer.nas index 4a77a2882..371101144 100644 --- a/Nasal/multiplayer.nas +++ b/Nasal/multiplayer.nas @@ -363,16 +363,22 @@ var model = { me.update(); }, update: func(n = nil) { - if (n != nil and props.globals.getNode(n, 1).getName() != "multiplayer") + var changedNode = props.globals.getNode( n, 1 ); + if (n != nil and changedNode.getName() != "multiplayer") return; + var changedNodeIndex = changedNode != nil ? changedNode.getIndex() : -1; + me.data = {}; me.callsign = {}; me.available = []; me.unavailable = []; foreach (var n; props.globals.getNode("ai/models", 1).getChildren("multiplayer")) { - if (!n.getNode("valid", 1).getValue()) + # Ignore valid property for the newly added multiplayer aircraft. + # It is false when model-added is triggered and will become true after this + # listener is finished + if (n.getIndex() != changedNodeIndex and !n.getNode("valid", 1).getValue()) continue; if ((var callsign = n.getNode("callsign")) == nil or !(callsign = callsign.getValue()))