Ref T273, Ref T275 XPlane uses simulator common function to skip sending equal parts/situations

This commit is contained in:
Klaus Basan
2018-06-04 17:45:36 +02:00
parent 1f00c71fea
commit f3edf14186
2 changed files with 25 additions and 20 deletions

View File

@@ -727,9 +727,9 @@ namespace BlackSimPlugin
const CAircraftSituation interpolatedSituation(result); const CAircraftSituation interpolatedSituation(result);
// update situation // update situation
if (!xplaneAircraft.isSameAsSent(interpolatedSituation)) if (!this->isEqualLastSent(interpolatedSituation))
{ {
m_xplaneAircraftObjects[xplaneAircraft.getCallsign()].setSituationAsSent(interpolatedSituation); this->rememberLastSent(interpolatedSituation);
planesPositions.callsigns.push_back(interpolatedSituation.getCallsign().asString()); planesPositions.callsigns.push_back(interpolatedSituation.getCallsign().asString());
planesPositions.latitudes.push_back(interpolatedSituation.latitude().value(CAngleUnit::deg())); planesPositions.latitudes.push_back(interpolatedSituation.latitude().value(CAngleUnit::deg()));
planesPositions.longitudes.push_back(interpolatedSituation.longitude().value(CAngleUnit::deg())); planesPositions.longitudes.push_back(interpolatedSituation.longitude().value(CAngleUnit::deg()));
@@ -747,23 +747,27 @@ namespace BlackSimPlugin
const CAircraftParts parts(result); const CAircraftParts parts(result);
if (result.getPartsStatus().isSupportingParts() || parts.getPartsDetails() == CAircraftParts::GuessedParts) if (result.getPartsStatus().isSupportingParts() || parts.getPartsDetails() == CAircraftParts::GuessedParts)
{ {
planesSurfaces.callsigns.push_back(xplaneAircraft.getCallsign().asString()); if (!this->isEqualLastSent(parts, callsign))
planesSurfaces.gears.push_back(parts.isGearDown() ? 1 : 0); {
planesSurfaces.flaps.push_back(parts.getFlapsPercent() / 100.0); this->rememberLastSent(parts, callsign);
planesSurfaces.spoilers.push_back(parts.isSpoilersOut() ? 1 : 0); planesSurfaces.callsigns.push_back(xplaneAircraft.getCallsign().asString());
planesSurfaces.speedBrakes.push_back(parts.isSpoilersOut() ? 1 : 0); planesSurfaces.gears.push_back(parts.isGearDown() ? 1 : 0);
planesSurfaces.slats.push_back(parts.getFlapsPercent() / 100.0); planesSurfaces.flaps.push_back(parts.getFlapsPercent() / 100.0);
planesSurfaces.wingSweeps.push_back(0.0); planesSurfaces.spoilers.push_back(parts.isSpoilersOut() ? 1 : 0);
planesSurfaces.thrusts.push_back(parts.isAnyEngineOn() ? 0 : 0.75); planesSurfaces.speedBrakes.push_back(parts.isSpoilersOut() ? 1 : 0);
planesSurfaces.elevators.push_back(0.0); planesSurfaces.slats.push_back(parts.getFlapsPercent() / 100.0);
planesSurfaces.rudders.push_back(0.0); planesSurfaces.wingSweeps.push_back(0.0);
planesSurfaces.ailerons.push_back(0.0); planesSurfaces.thrusts.push_back(parts.isAnyEngineOn() ? 0 : 0.75);
planesSurfaces.landLights.push_back(parts.getLights().isLandingOn()); planesSurfaces.elevators.push_back(0.0);
planesSurfaces.beaconLights.push_back(parts.getLights().isBeaconOn()); planesSurfaces.rudders.push_back(0.0);
planesSurfaces.strobeLights.push_back(parts.getLights().isStrobeOn()); planesSurfaces.ailerons.push_back(0.0);
planesSurfaces.navLights.push_back(parts.getLights().isNavOn()); planesSurfaces.landLights.push_back(parts.getLights().isLandingOn());
planesSurfaces.lightPatterns.push_back(0); planesSurfaces.beaconLights.push_back(parts.getLights().isBeaconOn());
planesSurfaces.onGrounds.push_back(parts.isOnGround()); planesSurfaces.strobeLights.push_back(parts.getLights().isStrobeOn());
planesSurfaces.navLights.push_back(parts.getLights().isNavOn());
planesSurfaces.lightPatterns.push_back(0);
planesSurfaces.onGrounds.push_back(parts.isOnGround());
}
} }
} // all callsigns } // all callsigns

View File

@@ -59,10 +59,11 @@ namespace BlackSimPlugin
const BlackMisc::Aviation::CAircraftSituation &getSituationAsSent() const { return m_situationAsSent; } const BlackMisc::Aviation::CAircraftSituation &getSituationAsSent() const { return m_situationAsSent; }
//! Position as sent //! Position as sent
//! \deprecated KB T273 use BlackCore::CSimulatorCommon isEqual / remember functions
void setSituationAsSent(const BlackMisc::Aviation::CAircraftSituation &position) { m_situationAsSent = position; } void setSituationAsSent(const BlackMisc::Aviation::CAircraftSituation &position) { m_situationAsSent = position; }
//! Same as sent //! Same as sent
//! \deprecated KB T273 //! \deprecated KB T273 use BlackCore::CSimulatorCommon isEqual / remember functions
bool isSameAsSent(const BlackMisc::Aviation::CAircraftSituation &position) const; bool isSameAsSent(const BlackMisc::Aviation::CAircraftSituation &position) const;
//! VTOL? //! VTOL?