mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-29 12:45:40 +08:00
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:
@@ -516,6 +516,27 @@ namespace BlackSimPlugin
|
|||||||
situation.getBank().value(CAngleUnit::deg()),
|
situation.getBank().value(CAngleUnit::deg()),
|
||||||
situation.getHeading().value(CAngleUnit::deg()),
|
situation.getHeading().value(CAngleUnit::deg()),
|
||||||
situation.getAdjustedMSecsSinceEpoch() - QDateTime::currentMSecsSinceEpoch());
|
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)
|
void CSimulatorXPlane::ps_remoteProviderAddAircraftParts(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftParts &parts)
|
||||||
|
|||||||
Reference in New Issue
Block a user