Regularly update X-Plane simulated aircraft

The simulated aircraft object has been set only once for each X-Plane aircraft as soon as adding to the simulator succeeded. Any updates to transponder codes, modes etc. were missed and never updated.
To make sure we always have the latest information available, we update all known X-Plane aircraft every second in the slow timer tasks.

Manifest Tasks: T502
This commit is contained in:
Roland Rossgotterer
2019-01-07 16:22:47 +01:00
committed by Mat Sutcliffe
parent db8285868b
commit 8df4024bde
3 changed files with 15 additions and 0 deletions

View File

@@ -308,6 +308,13 @@ namespace BlackSimPlugin
this->updateOwnParts(parts);
this->requestRemoteAircraftDataFromXPlane();
for (CXPlaneMPAircraft &xplaneAircraft : m_xplaneAircraftObjects)
{
// Update remote aircraft to have the latest transponder modes, codes etc.
CSimulatedAircraft simulatedAircraft = this->getAircraftInRangeForCallsign(xplaneAircraft.getCallsign());
xplaneAircraft.setSimulatedAircraft(simulatedAircraft);
}
}
}

View File

@@ -32,6 +32,11 @@ namespace BlackSimPlugin
m_interpolator->initCorrespondingModel(aircraft.getModel());
}
void CXPlaneMPAircraft::setSimulatedAircraft(const CSimulatedAircraft &simulatedAircraft)
{
m_aircraft = simulatedAircraft;
}
QString CXPlaneMPAircraft::getInterpolatorInfo(CInterpolationAndRenderingSetupBase::InterpolatorMode mode) const
{
Q_ASSERT(m_interpolator);

View File

@@ -37,6 +37,9 @@ namespace BlackSimPlugin
//! Destructor
~CXPlaneMPAircraft() {}
//! Set simulated aircraft
void setSimulatedAircraft(const BlackMisc::Simulation::CSimulatedAircraft &simulatedAircraft);
//! Get callsign
const BlackMisc::Aviation::CCallsign &getCallsign() const { return m_aircraft.getCallsign(); }