refs #852 On each position update for aircraft not supporting parts,

X-Plane driver synthesizes a parts update with guessed onGround flag.
This commit is contained in:
Mathew Sutcliffe
2017-01-10 03:00:07 +00:00
parent 5b4f672c75
commit 2b76b27f97

View File

@@ -516,6 +516,27 @@ namespace BlackSimPlugin
situation.getBank().value(CAngleUnit::deg()),
situation.getHeading().value(CAngleUnit::deg()),
situation.getAdjustedMSecsSinceEpoch() - QDateTime::currentMSecsSinceEpoch());
if (! isRemoteAircraftSupportingParts(situation.getCallsign()))
{
// if aircraft not supporting parts then guess (currently only onGround is guessed)
//! \todo not working for vtol
BlackMisc::Aviation::CAircraftParts parts;
parts.setMSecsSinceEpoch(situation.getMSecsSinceEpoch());
parts.setTimeOffsetMs(situation.getTimeOffsetMs());
if (situation.getGroundSpeed() < CSpeed(50, CSpeedUnit::kts()))
{
const auto nearestAirport = std::min_element(m_airportsInRange.cbegin(), m_airportsInRange.cend(), [&situation](auto &&a, auto &&b)
{
return calculateEuclideanDistanceSquared(situation, a) < calculateEuclideanDistanceSquared(situation, b);
});
if (nearestAirport != m_airportsInRange.cend() && situation.getAltitude() - nearestAirport->getElevation() < CLength(50, CLengthUnit::ft()))
{
parts.setOnGround(true);
}
}
ps_remoteProviderAddAircraftParts(situation.getCallsign(), parts);
}
}
void CSimulatorXPlane::ps_remoteProviderAddAircraftParts(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftParts &parts)