From 6f5b4c5de8f7267bc236302bcf899bc764bd495e Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sun, 10 Jun 2018 14:52:42 +0200 Subject: [PATCH] Ref T275, used "pending" function (FSX/P3D) to check if we can request position data --- src/plugins/simulator/fsxcommon/simconnectobject.h | 3 +++ src/plugins/simulator/fsxcommon/simulatorfsxcommon.cpp | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/simulator/fsxcommon/simconnectobject.h b/src/plugins/simulator/fsxcommon/simconnectobject.h index 15f8044f3..f04e551fb 100644 --- a/src/plugins/simulator/fsxcommon/simconnectobject.h +++ b/src/plugins/simulator/fsxcommon/simconnectobject.h @@ -155,6 +155,9 @@ namespace BlackSimPlugin //! Marked as pending for removal void setPendingRemoved(bool pending); + //! Pending added or removed? + bool isPending() const { return this->isPendingAdded() || this->isPendingRemoved(); } + //! Reset the state (like it was a new onject) without affecting interpolator and aircraft void resetState(); diff --git a/src/plugins/simulator/fsxcommon/simulatorfsxcommon.cpp b/src/plugins/simulator/fsxcommon/simulatorfsxcommon.cpp index 0c5df621b..704adc463 100644 --- a/src/plugins/simulator/fsxcommon/simulatorfsxcommon.cpp +++ b/src/plugins/simulator/fsxcommon/simulatorfsxcommon.cpp @@ -72,7 +72,7 @@ namespace BlackSimPlugin bool CSimulatorFsxCommon::isConnected() const { - return m_simConnected; + return m_simConnected && m_hSimConnect; } bool CSimulatorFsxCommon::isSimulating() const @@ -1646,8 +1646,7 @@ namespace BlackSimPlugin { if (this->isShuttingDownOrDisconnected()) { return false; } if (!simObject.hasValidRequestAndObjectId()) { return false; } - if (simObject.isPendingRemoved()) { return false; } - if (!m_hSimConnect) { return false; } + if (simObject.isPending()) { return false; } // wait until confirmed if (simObject.getSimDataPeriod() == period) { return true; } // already queried like this // always request, not only when something has changed