From 662dad08484bcd04e75cb9bc7f108aaf1ea0cffa Mon Sep 17 00:00:00 2001 From: Richard Harrison Date: Thu, 17 Mar 2022 11:51:52 +0100 Subject: [PATCH] Fix MP Pilot List disappearing Ensure that lag/lag-mod-averaged is created and set to a valid value (0) prior to calling the base class init method as otherwise the MPList will have a nil reference. This needs to be done prior to the base class ::init() because that method sets the model-added property which will trigger the lisetener. --- src/AIModel/AIMultiplayer.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/AIModel/AIMultiplayer.cxx b/src/AIModel/AIMultiplayer.cxx index d6cb41aba..30b221a0a 100644 --- a/src/AIModel/AIMultiplayer.cxx +++ b/src/AIModel/AIMultiplayer.cxx @@ -51,6 +51,7 @@ bool FGAIMultiplayer::init(ModelSearchOrder searchOrder) { props->setStringValue("sim/model/path", model_path); props->setIntValue("sim/model/fallback-model-index", _getFallbackModelIndex()); + //refuel_node = fgGetNode("systems/refuel/contact", true); isTanker = false; // do this until this property is // passed over the net @@ -64,6 +65,12 @@ bool FGAIMultiplayer::init(ModelSearchOrder searchOrder) isTanker = true; // cout << "isTanker " << isTanker << " " << mCallSign <getNode("lag/pps-averaged", true); + m_lagPPSAveragedNode->setDoubleValue(0); + m_lagModAveragedNode = props->getNode("lag/lag-mod-averaged", true); + m_lagModAveragedNode->setDoubleValue(0); // load model bool result = FGAIBase::init(searchOrder); @@ -98,9 +105,6 @@ void FGAIMultiplayer::bind() m_node_ai_latch = props->getNode("ai-latch", true /*create*/); m_node_log_multiplayer = globals->get_props()->getNode("/sim/log-multiplayer-callsign", true /*create*/); - m_lagPPSAveragedNode = props->getNode("lag/pps-averaged", true); - m_lagModAveragedNode = props->getNode("lag/lag-mod-averaged", true); - #define AIMPROProp(type, name) \ SGRawValueMethods(*this, &FGAIMultiplayer::get##name)