diff --git a/src/plugins/simulator/fsxcommon/simconnectobject.h b/src/plugins/simulator/fsxcommon/simconnectobject.h index e4b1b225e..15f8044f3 100644 --- a/src/plugins/simulator/fsxcommon/simconnectobject.h +++ b/src/plugins/simulator/fsxcommon/simconnectobject.h @@ -80,24 +80,31 @@ namespace BlackSimPlugin void fakeCurrentLightsInSimulator() { m_currentLightsInSim.setNull(false); } //! Parts as sent to simulator + //! \deprecated KB T273 use BlackCore::CSimulatorCommon isEqual / remember functions const DataDefinitionRemoteAircraftPartsWithoutLights &getPartsAsSent() const { return m_partsAsSent; } //! Parts as sent to simulator + //! \deprecated KB T273 use BlackCore::CSimulatorCommon isEqual / remember functions void setPartsAsSent(const DataDefinitionRemoteAircraftPartsWithoutLights &parts) { m_partsAsSent = parts; } //! Invalidate parts as sent + //! \deprecated KB T273 use BlackCore::CSimulatorCommon isEqual / remember functions void invalidatePartsAsSent(); //! Parts as sent to simulator + //! \deprecated KB T273 use BlackCore::CSimulatorCommon isEqual / remember functions const SIMCONNECT_DATA_INITPOSITION &getPositionAsSent() const { return m_positionAsSent; } //! Position as sent + //! \deprecated KB T273 use BlackCore::CSimulatorCommon isEqual / remember functions void setPositionAsSent(const SIMCONNECT_DATA_INITPOSITION &position) { m_positionAsSent = position; } //! Same as sent + //! \deprecated KB T273 use BlackCore::CSimulatorCommon isEqual / remember functions bool isSameAsSent(const SIMCONNECT_DATA_INITPOSITION &position) const; - //! Invalidate position as sent; + //! Invalidate position as sent + //! \deprecated KB T273 use BlackCore::CSimulatorCommon isEqual / remember functions void invalidatePositionAsSent(); //! Lights as sent to simulator diff --git a/src/plugins/simulator/fsxcommon/simulatorfsxcommon.cpp b/src/plugins/simulator/fsxcommon/simulatorfsxcommon.cpp index 3dcc2c8cb..682282b7d 100644 --- a/src/plugins/simulator/fsxcommon/simulatorfsxcommon.cpp +++ b/src/plugins/simulator/fsxcommon/simulatorfsxcommon.cpp @@ -1275,15 +1275,16 @@ namespace BlackSimPlugin if (result.getInterpolationStatus().hasValidSituation()) { // update situation - SIMCONNECT_DATA_INITPOSITION position = this->aircraftSituationToFsxPosition(result, sendGround); - if (!simObject.isSameAsSent(position)) + if (!this->isEqualLastSent(result)) { + SIMCONNECT_DATA_INITPOSITION position = this->aircraftSituationToFsxPosition(result, sendGround); m_simConnectObjects[simObject.getCallsign()].setPositionAsSent(position); const HRESULT hr = SimConnect_SetDataOnSimObject(m_hSimConnect, CSimConnectDefinitions::DataRemoteAircraftSetPosition, static_cast(simObject.getObjectId()), 0, 0, sizeof(SIMCONNECT_DATA_INITPOSITION), &position); if (hr == S_OK) { + this->rememberLastSent(result); // remember if (m_traceSendId) { this->traceSendId(simObject.getObjectId(), Q_FUNC_INFO); } this->removedClampedLog(callsign); } @@ -1316,6 +1317,7 @@ namespace BlackSimPlugin const CAircraftParts parts = result; if (parts.getPartsDetails() != CAircraftParts::GuessedParts && !result.getPartsStatus().isSupportingParts()) { return false; } + if (this->isEqualLastSent(parts, simObject.getCallsign())) { return true; } DataDefinitionRemoteAircraftPartsWithoutLights ddRemoteAircraftPartsWithoutLights(parts); // no init, all values will be set return this->sendRemoteAircraftPartsToSimulator(simObject, ddRemoteAircraftPartsWithoutLights, parts.getAdjustedLights()); @@ -1326,13 +1328,6 @@ namespace BlackSimPlugin Q_ASSERT(m_hSimConnect); const DWORD objectId = simObject.getObjectId(); - // same as in simulator or same as already send to simulator? - const CAircraftLights sentLights(simObject.getLightsAsSent()); - if (simObject.getPartsAsSent() == ddRemoteAircraftPartsWithoutLights && sentLights == lights) - { - return true; - } - // in case we sent, we sent everything const HRESULT hr = SimConnect_SetDataOnSimObject(m_hSimConnect, CSimConnectDefinitions::DataRemoteAircraftParts, objectId, SIMCONNECT_DATA_SET_FLAG_DEFAULT, 0,