From f3edf141860cff077ce91ff22e88e3e61fe98aed Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Mon, 4 Jun 2018 17:45:36 +0200 Subject: [PATCH] Ref T273, Ref T275 XPlane uses simulator common function to skip sending equal parts/situations --- .../simulator/xplane/simulatorxplane.cpp | 42 ++++++++++--------- .../simulator/xplane/xplanempaircraft.h | 3 +- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/plugins/simulator/xplane/simulatorxplane.cpp b/src/plugins/simulator/xplane/simulatorxplane.cpp index 6208f8d83..f129d2fe6 100644 --- a/src/plugins/simulator/xplane/simulatorxplane.cpp +++ b/src/plugins/simulator/xplane/simulatorxplane.cpp @@ -727,9 +727,9 @@ namespace BlackSimPlugin const CAircraftSituation interpolatedSituation(result); // 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.latitudes.push_back(interpolatedSituation.latitude().value(CAngleUnit::deg())); planesPositions.longitudes.push_back(interpolatedSituation.longitude().value(CAngleUnit::deg())); @@ -747,23 +747,27 @@ namespace BlackSimPlugin const CAircraftParts parts(result); if (result.getPartsStatus().isSupportingParts() || parts.getPartsDetails() == CAircraftParts::GuessedParts) { - planesSurfaces.callsigns.push_back(xplaneAircraft.getCallsign().asString()); - planesSurfaces.gears.push_back(parts.isGearDown() ? 1 : 0); - planesSurfaces.flaps.push_back(parts.getFlapsPercent() / 100.0); - planesSurfaces.spoilers.push_back(parts.isSpoilersOut() ? 1 : 0); - planesSurfaces.speedBrakes.push_back(parts.isSpoilersOut() ? 1 : 0); - planesSurfaces.slats.push_back(parts.getFlapsPercent() / 100.0); - planesSurfaces.wingSweeps.push_back(0.0); - planesSurfaces.thrusts.push_back(parts.isAnyEngineOn() ? 0 : 0.75); - planesSurfaces.elevators.push_back(0.0); - planesSurfaces.rudders.push_back(0.0); - planesSurfaces.ailerons.push_back(0.0); - planesSurfaces.landLights.push_back(parts.getLights().isLandingOn()); - planesSurfaces.beaconLights.push_back(parts.getLights().isBeaconOn()); - 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()); + if (!this->isEqualLastSent(parts, callsign)) + { + this->rememberLastSent(parts, callsign); + planesSurfaces.callsigns.push_back(xplaneAircraft.getCallsign().asString()); + planesSurfaces.gears.push_back(parts.isGearDown() ? 1 : 0); + planesSurfaces.flaps.push_back(parts.getFlapsPercent() / 100.0); + planesSurfaces.spoilers.push_back(parts.isSpoilersOut() ? 1 : 0); + planesSurfaces.speedBrakes.push_back(parts.isSpoilersOut() ? 1 : 0); + planesSurfaces.slats.push_back(parts.getFlapsPercent() / 100.0); + planesSurfaces.wingSweeps.push_back(0.0); + planesSurfaces.thrusts.push_back(parts.isAnyEngineOn() ? 0 : 0.75); + planesSurfaces.elevators.push_back(0.0); + planesSurfaces.rudders.push_back(0.0); + planesSurfaces.ailerons.push_back(0.0); + planesSurfaces.landLights.push_back(parts.getLights().isLandingOn()); + planesSurfaces.beaconLights.push_back(parts.getLights().isBeaconOn()); + 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 diff --git a/src/plugins/simulator/xplane/xplanempaircraft.h b/src/plugins/simulator/xplane/xplanempaircraft.h index ce54982e2..c207db7aa 100644 --- a/src/plugins/simulator/xplane/xplanempaircraft.h +++ b/src/plugins/simulator/xplane/xplanempaircraft.h @@ -59,10 +59,11 @@ namespace BlackSimPlugin const BlackMisc::Aviation::CAircraftSituation &getSituationAsSent() const { return m_situationAsSent; } //! Position as sent + //! \deprecated KB T273 use BlackCore::CSimulatorCommon isEqual / remember functions void setSituationAsSent(const BlackMisc::Aviation::CAircraftSituation &position) { m_situationAsSent = position; } //! Same as sent - //! \deprecated KB T273 + //! \deprecated KB T273 use BlackCore::CSimulatorCommon isEqual / remember functions bool isSameAsSent(const BlackMisc::Aviation::CAircraftSituation &position) const; //! VTOL?