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.
This commit is contained in:
parent
360c64c7b7
commit
662dad0848
1 changed files with 7 additions and 3 deletions
|
@ -51,6 +51,7 @@ bool FGAIMultiplayer::init(ModelSearchOrder searchOrder)
|
||||||
{
|
{
|
||||||
props->setStringValue("sim/model/path", model_path);
|
props->setStringValue("sim/model/path", model_path);
|
||||||
props->setIntValue("sim/model/fallback-model-index", _getFallbackModelIndex());
|
props->setIntValue("sim/model/fallback-model-index", _getFallbackModelIndex());
|
||||||
|
|
||||||
//refuel_node = fgGetNode("systems/refuel/contact", true);
|
//refuel_node = fgGetNode("systems/refuel/contact", true);
|
||||||
isTanker = false; // do this until this property is
|
isTanker = false; // do this until this property is
|
||||||
// passed over the net
|
// passed over the net
|
||||||
|
@ -64,6 +65,12 @@ bool FGAIMultiplayer::init(ModelSearchOrder searchOrder)
|
||||||
isTanker = true;
|
isTanker = true;
|
||||||
// cout << "isTanker " << isTanker << " " << mCallSign <<endl;
|
// cout << "isTanker " << isTanker << " " << mCallSign <<endl;
|
||||||
}
|
}
|
||||||
|
// ensure that these are created prior to calling base class init
|
||||||
|
// as otherwise the MP list will break
|
||||||
|
m_lagPPSAveragedNode = props->getNode("lag/pps-averaged", true);
|
||||||
|
m_lagPPSAveragedNode->setDoubleValue(0);
|
||||||
|
m_lagModAveragedNode = props->getNode("lag/lag-mod-averaged", true);
|
||||||
|
m_lagModAveragedNode->setDoubleValue(0);
|
||||||
|
|
||||||
// load model
|
// load model
|
||||||
bool result = FGAIBase::init(searchOrder);
|
bool result = FGAIBase::init(searchOrder);
|
||||||
|
@ -98,9 +105,6 @@ void FGAIMultiplayer::bind()
|
||||||
m_node_ai_latch = props->getNode("ai-latch", true /*create*/);
|
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_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) \
|
#define AIMPROProp(type, name) \
|
||||||
SGRawValueMethods<FGAIMultiplayer, type>(*this, &FGAIMultiplayer::get##name)
|
SGRawValueMethods<FGAIMultiplayer, type>(*this, &FGAIMultiplayer::get##name)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue