mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
Ref T423, force update if simulator was paused or interrupted before
* force full updates for some cycles "m_updateAllRemoteAircraftCycles" * only use "emitSimulatorCombinedStatus" to emit changed simulator status * renamed to "finishUpdateRemoteAircraftAndSetStatistics" * override "forced" in "getInterpolationSetupConsolidated" This addresses the issue that aircraft appear below ground after moving the aircraft
This commit is contained in:
@@ -292,11 +292,12 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CInterpolationAndRenderingSetupPerCallsign ISimulator::getInterpolationSetupConsolidated(const CCallsign &callsign) const
|
CInterpolationAndRenderingSetupPerCallsign ISimulator::getInterpolationSetupConsolidated(const CCallsign &callsign, bool forceFullUpdate) const
|
||||||
{
|
{
|
||||||
CInterpolationAndRenderingSetupPerCallsign setup = this->getInterpolationSetupPerCallsignOrDefault(callsign);
|
CInterpolationAndRenderingSetupPerCallsign setup = this->getInterpolationSetupPerCallsignOrDefault(callsign);
|
||||||
const CClient client = this->getClientOrDefaultForCallsign(callsign);
|
const CClient client = this->getClientOrDefaultForCallsign(callsign);
|
||||||
setup.consolidateWithClient(client);
|
setup.consolidateWithClient(client);
|
||||||
|
if (forceFullUpdate) { setup.setForceFullInterpolation(forceFullUpdate); }
|
||||||
return setup;
|
return setup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -709,14 +710,14 @@ namespace BlackCore
|
|||||||
CAirportList ISimulator::getWebServiceAirports() const
|
CAirportList ISimulator::getWebServiceAirports() const
|
||||||
{
|
{
|
||||||
if (this->isShuttingDown()) { return CAirportList(); }
|
if (this->isShuttingDown()) { return CAirportList(); }
|
||||||
if (!sApp->hasWebDataServices()) { return CAirportList(); }
|
if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return CAirportList(); }
|
||||||
return sApp->getWebDataServices()->getAirports();
|
return sApp->getWebDataServices()->getAirports();
|
||||||
}
|
}
|
||||||
|
|
||||||
CAirport ISimulator::getWebServiceAirport(const CAirportIcaoCode &icao) const
|
CAirport ISimulator::getWebServiceAirport(const CAirportIcaoCode &icao) const
|
||||||
{
|
{
|
||||||
if (this->isShuttingDown()) { return CAirport(); }
|
if (this->isShuttingDown()) { return CAirport(); }
|
||||||
if (!sApp->hasWebDataServices()) { return CAirport(); }
|
if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return CAirport(); }
|
||||||
return sApp->getWebDataServices()->getAirports().findFirstByIcao(icao);
|
return sApp->getWebDataServices()->getAirports().findFirstByIcao(icao);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -771,8 +772,15 @@ namespace BlackCore
|
|||||||
QPointer<ISimulator> myself(this);
|
QPointer<ISimulator> myself(this);
|
||||||
QTimer::singleShot(0, this, [ = ]
|
QTimer::singleShot(0, this, [ = ]
|
||||||
{
|
{
|
||||||
if (!myself) { return; }
|
if (!myself || !sApp || sApp->isShuttingDown()) { return; }
|
||||||
emit myself->simulatorStatusChanged(newStatus);
|
|
||||||
|
// now simulating
|
||||||
|
if (newStatus.testFlag(Simulating))
|
||||||
|
{
|
||||||
|
m_updateAllRemoteAircraftCycles = 10; // force an update of every remote aircraft
|
||||||
|
}
|
||||||
|
|
||||||
|
emit this->simulatorStatusChanged(newStatus); // only place where we should emit the signal, use emitSimulatorCombinedStatus to emit
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -833,7 +841,7 @@ namespace BlackCore
|
|||||||
bool ISimulator::isUpdateAircraftLimitedWithStats(qint64 startTime)
|
bool ISimulator::isUpdateAircraftLimitedWithStats(qint64 startTime)
|
||||||
{
|
{
|
||||||
const bool limited = this->isUpdateAircraftLimited(startTime);
|
const bool limited = this->isUpdateAircraftLimited(startTime);
|
||||||
this->setStatsRemoteAircraftUpdate(startTime, limited);
|
this->finishUpdateRemoteAircraftAndSetStatistics(startTime, limited);
|
||||||
return limited;
|
return limited;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -991,7 +999,7 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
depreatced **/
|
depreatced **/
|
||||||
|
|
||||||
void ISimulator::setStatsRemoteAircraftUpdate(qint64 startTime, bool limited)
|
void ISimulator::finishUpdateRemoteAircraftAndSetStatistics(qint64 startTime, bool limited)
|
||||||
{
|
{
|
||||||
const qint64 now = QDateTime::currentMSecsSinceEpoch();
|
const qint64 now = QDateTime::currentMSecsSinceEpoch();
|
||||||
const qint64 dt = now - startTime;
|
const qint64 dt = now - startTime;
|
||||||
@@ -1002,6 +1010,7 @@ namespace BlackCore
|
|||||||
m_updateRemoteAircraftInProgress = false;
|
m_updateRemoteAircraftInProgress = false;
|
||||||
m_statsLastUpdateAircraftRequestedMs = startTime;
|
m_statsLastUpdateAircraftRequestedMs = startTime;
|
||||||
|
|
||||||
|
if (m_updateAllRemoteAircraftCycles > 0) { m_updateAllRemoteAircraftCycles--; }
|
||||||
if (m_statsMaxUpdateTimeMs < dt) { m_statsMaxUpdateTimeMs = dt; }
|
if (m_statsMaxUpdateTimeMs < dt) { m_statsMaxUpdateTimeMs = dt; }
|
||||||
if (m_statsLastUpdateAircraftRequestedMs > 0) { m_statsUpdateAircraftRequestedDeltaMs = startTime - m_statsLastUpdateAircraftRequestedMs; }
|
if (m_statsLastUpdateAircraftRequestedMs > 0) { m_statsUpdateAircraftRequestedDeltaMs = startTime - m_statsLastUpdateAircraftRequestedMs; }
|
||||||
if (limited) { m_statsUpdateAircraftLimited++; }
|
if (limited) { m_statsUpdateAircraftLimited++; }
|
||||||
@@ -1098,6 +1107,7 @@ namespace BlackCore
|
|||||||
Q_ASSERT_X(sApp->hasWebDataServices(), Q_FUNC_INFO, "Missing web services");
|
Q_ASSERT_X(sApp->hasWebDataServices(), Q_FUNC_INFO, "Missing web services");
|
||||||
|
|
||||||
if (!model.hasModelString()) { return; }
|
if (!model.hasModelString()) { return; }
|
||||||
|
if (this->isShuttingDown()) { return; }
|
||||||
if (this->getOwnAircraftModel() != model)
|
if (this->getOwnAircraftModel() != model)
|
||||||
{
|
{
|
||||||
if (CDatabaseUtils::hasDbAircraftData())
|
if (CDatabaseUtils::hasDbAircraftData())
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
//! Consolidate setup with other data like from BlackMisc::Simulation::IRemoteAircraftProvider
|
//! Consolidate setup with other data like from BlackMisc::Simulation::IRemoteAircraftProvider
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
BlackMisc::Simulation::CInterpolationAndRenderingSetupPerCallsign getInterpolationSetupConsolidated(const BlackMisc::Aviation::CCallsign &callsign) const;
|
BlackMisc::Simulation::CInterpolationAndRenderingSetupPerCallsign getInterpolationSetupConsolidated(const BlackMisc::Aviation::CCallsign &callsign, bool forceFullUpdate) const;
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Simulation::IInterpolationSetupProvider::setInterpolationSetupGlobal
|
//! \copydoc BlackMisc::Simulation::IInterpolationSetupProvider::setInterpolationSetupGlobal
|
||||||
virtual bool setInterpolationSetupGlobal(const BlackMisc::Simulation::CInterpolationAndRenderingSetupGlobal &setup) override;
|
virtual bool setInterpolationSetupGlobal(const BlackMisc::Simulation::CInterpolationAndRenderingSetupGlobal &setup) override;
|
||||||
@@ -328,7 +328,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! Simulator combined status
|
//! Simulator combined status
|
||||||
void simulatorStatusChanged(SimulatorStatus status);
|
void simulatorStatusChanged(SimulatorStatus status); // use emitSimulatorCombinedStatus to emit
|
||||||
|
|
||||||
//! Emitted when own aircraft model has changed
|
//! Emitted when own aircraft model has changed
|
||||||
void ownAircraftModelChanged(const BlackMisc::Simulation::CAircraftModel &model);
|
void ownAircraftModelChanged(const BlackMisc::Simulation::CAircraftModel &model);
|
||||||
@@ -518,13 +518,14 @@ namespace BlackCore
|
|||||||
// void removedClampedLog(const BlackMisc::Aviation::CCallsign &callsign);
|
// void removedClampedLog(const BlackMisc::Aviation::CCallsign &callsign);
|
||||||
|
|
||||||
//! Update stats and flags
|
//! Update stats and flags
|
||||||
void setStatsRemoteAircraftUpdate(qint64 startTime, bool limited = false);
|
void finishUpdateRemoteAircraftAndSetStatistics(qint64 startTime, bool limited = false);
|
||||||
|
|
||||||
//! Lookup against DB data
|
//! Lookup against DB data
|
||||||
static BlackMisc::Simulation::CAircraftModel reverseLookupModel(const BlackMisc::Simulation::CAircraftModel &model);
|
static BlackMisc::Simulation::CAircraftModel reverseLookupModel(const BlackMisc::Simulation::CAircraftModel &model);
|
||||||
|
|
||||||
bool m_pausedSimFreezesInterpolation = false; //!< paused simulator will also pause interpolation (so AI aircraft will hold)
|
bool m_pausedSimFreezesInterpolation = false; //!< paused simulator will also pause interpolation (so AI aircraft will hold)
|
||||||
bool m_updateRemoteAircraftInProgress = false; //!< currently updating remote aircraft
|
bool m_updateRemoteAircraftInProgress = false; //!< currently updating remote aircraft
|
||||||
|
int m_updateAllRemoteAircraftCycles = 0; //!< force an update of all remote aircraft, used when own aircraft is moved, paused to make sure all remote aircraft are updated
|
||||||
int m_timerId = -1; //!< dispatch timer id
|
int m_timerId = -1; //!< dispatch timer id
|
||||||
int m_statsUpdateAircraftRuns = 0; //!< statistics update count
|
int m_statsUpdateAircraftRuns = 0; //!< statistics update count
|
||||||
int m_statsUpdateAircraftLimited = 0; //!< skipped because of max.update limitations
|
int m_statsUpdateAircraftLimited = 0; //!< skipped because of max.update limitations
|
||||||
@@ -573,7 +574,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
// statistics values of how often those functions are called
|
// statistics values of how often those functions are called
|
||||||
// those are the added counters, overflow will not be an issue here (discussed in T171 review)
|
// those are the added counters, overflow will not be an issue here (discussed in T171 review)
|
||||||
int m_statsPhysicallyAddedAircraft = 0; //!< statistics, how many aircraft added
|
int m_statsPhysicallyAddedAircraft = 0; //!< statistics, how many aircraft added
|
||||||
int m_statsPhysicallyRemovedAircraft = 0; //!< statistics, how many aircraft removed
|
int m_statsPhysicallyRemovedAircraft = 0; //!< statistics, how many aircraft removed
|
||||||
|
|
||||||
// highlighting
|
// highlighting
|
||||||
@@ -585,8 +586,8 @@ namespace BlackCore
|
|||||||
int m_timerCounter = 0; //!< allows to calculate n seconds
|
int m_timerCounter = 0; //!< allows to calculate n seconds
|
||||||
QTimer m_oneSecondTimer; //!< multi purpose timer with 1 sec. interval
|
QTimer m_oneSecondTimer; //!< multi purpose timer with 1 sec. interval
|
||||||
|
|
||||||
// misc. as callsigns
|
// misc.
|
||||||
bool m_networkConnected = false; //!< flight network connected
|
bool m_networkConnected = false; //!< flight network connected
|
||||||
BlackMisc::Aviation::CCallsignSet m_callsignsToBeRendered; //!< callsigns which will be rendered
|
BlackMisc::Aviation::CCallsignSet m_callsignsToBeRendered; //!< callsigns which will be rendered
|
||||||
BlackMisc::CConnectionGuard m_remoteAircraftProviderConnections; //!< connected signal/slots
|
BlackMisc::CConnectionGuard m_remoteAircraftProviderConnections; //!< connected signal/slots
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -451,7 +451,7 @@ namespace BlackSimPlugin
|
|||||||
Q_UNUSED(p);
|
Q_UNUSED(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->setStatsRemoteAircraftUpdate(now);
|
this->finishUpdateRemoteAircraftAndSetStatistics(now);
|
||||||
}
|
}
|
||||||
|
|
||||||
CSimulatorEmulatedListener::CSimulatorEmulatedListener(const CSimulatorPluginInfo &info)
|
CSimulatorEmulatedListener::CSimulatorEmulatedListener(const CSimulatorPluginInfo &info)
|
||||||
|
|||||||
@@ -182,8 +182,10 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
|
|
||||||
|
// remark: in FS9 there is no central updateRemoteAircraft() function, each FS9 client updates itself
|
||||||
if (m_clientStatus == Disconnected) { return; }
|
if (m_clientStatus == Disconnected) { return; }
|
||||||
const CInterpolationAndRenderingSetupPerCallsign setup = this->simulator()->getInterpolationSetupConsolidated(m_callsign);
|
const bool forceFullUpdate = false;
|
||||||
|
const CInterpolationAndRenderingSetupPerCallsign setup = this->simulator()->getInterpolationSetupConsolidated(m_callsign, forceFullUpdate);
|
||||||
const CInterpolationResult result = m_interpolator.getInterpolation(QDateTime::currentMSecsSinceEpoch(), setup, 0);
|
const CInterpolationResult result = m_interpolator.getInterpolation(QDateTime::currentMSecsSinceEpoch(), setup, 0);
|
||||||
|
|
||||||
// Test only for successful position. FS9 requires constant positions
|
// Test only for successful position. FS9 requires constant positions
|
||||||
|
|||||||
@@ -14,11 +14,12 @@
|
|||||||
#include "multiplayerpackets.h"
|
#include "multiplayerpackets.h"
|
||||||
#include "multiplayerpacketparser.h"
|
#include "multiplayerpacketparser.h"
|
||||||
#include "registermetadata.h"
|
#include "registermetadata.h"
|
||||||
|
#include "../fscommon/simulatorfscommonfunctions.h"
|
||||||
#include "blackmisc/network/textmessage.h"
|
#include "blackmisc/network/textmessage.h"
|
||||||
|
#include "blackmisc/simulation/fscommon/fscommonutil.h"
|
||||||
#include "blackmisc/simulation/simulatorplugininfo.h"
|
#include "blackmisc/simulation/simulatorplugininfo.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
#include "blackmisc/propertyindexallclasses.h"
|
#include "blackmisc/propertyindexallclasses.h"
|
||||||
#include "blackmisc/simulation/fscommon/fscommonutil.h"
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@@ -111,10 +112,10 @@ namespace BlackSimPlugin
|
|||||||
m_fs9Host(fs9Host),
|
m_fs9Host(fs9Host),
|
||||||
m_lobbyClient(lobbyClient)
|
m_lobbyClient(lobbyClient)
|
||||||
{
|
{
|
||||||
//! \fixme KB 7/2017 change or remove when reviewed Could we just use: connect(lobbyClient.data(), &CLobbyClient::disconnected, this, &CSimulatorFs9::disconnectFrom);
|
//! \fixme KB 7/2017 change or remove comment when reviewed Could we just use: connect(lobbyClient.data(), &CLobbyClient::disconnected, this, &CSimulatorFs9::disconnectFrom);
|
||||||
connect(lobbyClient.data(), &CLobbyClient::disconnected, this, [ = ]
|
connect(lobbyClient.data(), &CLobbyClient::disconnected, this, [ = ]
|
||||||
{
|
{
|
||||||
emit this->simulatorStatusChanged(ISimulator::Disconnected);
|
this->emitSimulatorCombinedStatus();
|
||||||
});
|
});
|
||||||
|
|
||||||
this->setDefaultModel(
|
this->setDefaultModel(
|
||||||
@@ -164,7 +165,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
bool CSimulatorFs9::physicallyAddRemoteAircraft(const CSimulatedAircraft &newRemoteAircraft)
|
bool CSimulatorFs9::physicallyAddRemoteAircraft(const CSimulatedAircraft &newRemoteAircraft)
|
||||||
{
|
{
|
||||||
CCallsign callsign = newRemoteAircraft.getCallsign();
|
const CCallsign callsign = newRemoteAircraft.getCallsign();
|
||||||
if (m_hashFs9Clients.contains(callsign))
|
if (m_hashFs9Clients.contains(callsign))
|
||||||
{
|
{
|
||||||
// already exists, remove first
|
// already exists, remove first
|
||||||
@@ -447,7 +448,7 @@ namespace BlackSimPlugin
|
|||||||
if (m_fs9Host->getHostAddress().isEmpty()) { return false; } // host not yet set up
|
if (m_fs9Host->getHostAddress().isEmpty()) { return false; } // host not yet set up
|
||||||
if (canLobbyConnect)
|
if (canLobbyConnect)
|
||||||
{
|
{
|
||||||
if (m_isConnecting || m_lobbyClient->connectFs9ToHost(m_fs9Host->getHostAddress()) == S_OK)
|
if (m_isConnecting || isOk(m_lobbyClient->connectFs9ToHost(m_fs9Host->getHostAddress())))
|
||||||
{
|
{
|
||||||
m_isConnecting = true;
|
m_isConnecting = true;
|
||||||
CLogMessage(this).info("swift is joining FS9 to the multiplayer session...");
|
CLogMessage(this).info("swift is joining FS9 to the multiplayer session...");
|
||||||
|
|||||||
@@ -84,6 +84,9 @@ namespace BlackSimPlugin
|
|||||||
virtual void injectWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid) override;
|
virtual void injectWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid) override;
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
// remark: in FS9 there is no central updateRemoteAircraft() function, each FS9 client updates itself
|
||||||
|
// updateRemoteAircraft()
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! Dispatch FSUIPC reading
|
//! Dispatch FSUIPC reading
|
||||||
//! \remark very frequently called
|
//! \remark very frequently called
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ namespace BlackSimPlugin
|
|||||||
CStatusMessageList CSimulatorFsxCommon::getInterpolationMessages(const CCallsign &callsign) const
|
CStatusMessageList CSimulatorFsxCommon::getInterpolationMessages(const CCallsign &callsign) const
|
||||||
{
|
{
|
||||||
if (!m_simConnectObjects.contains(callsign)) { return CStatusMessageList(); }
|
if (!m_simConnectObjects.contains(callsign)) { return CStatusMessageList(); }
|
||||||
const CInterpolationAndRenderingSetupPerCallsign setup = this->getInterpolationSetupConsolidated(callsign);
|
const CInterpolationAndRenderingSetupPerCallsign setup = this->getInterpolationSetupConsolidated(callsign, false);
|
||||||
return (m_simConnectObjects[callsign]).getInterpolationMessages(setup.getInterpolatorMode());
|
return (m_simConnectObjects[callsign]).getInterpolationMessages(setup.getInterpolatorMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1450,7 +1450,7 @@ namespace BlackSimPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// setup
|
// setup
|
||||||
const CInterpolationAndRenderingSetupPerCallsign setup = this->getInterpolationSetupConsolidated(callsign);
|
const CInterpolationAndRenderingSetupPerCallsign setup = this->getInterpolationSetupConsolidated(callsign, true);
|
||||||
const bool sendGround = setup.isSendingGndFlagToSimulator();
|
const bool sendGround = setup.isSendingGndFlagToSimulator();
|
||||||
|
|
||||||
// FSX/P3D adding
|
// FSX/P3D adding
|
||||||
@@ -1743,6 +1743,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
int simObjectNumber = 0;
|
int simObjectNumber = 0;
|
||||||
const bool traceSendId = this->isTracingSendId();
|
const bool traceSendId = this->isTracingSendId();
|
||||||
|
const bool updateAllAircraft = m_updateAllRemoteAircraftCycles > 0;
|
||||||
for (const CSimConnectObject &simObject : simObjects)
|
for (const CSimConnectObject &simObject : simObjects)
|
||||||
{
|
{
|
||||||
// happening if aircraft is not yet added to simulator or to be deleted
|
// happening if aircraft is not yet added to simulator or to be deleted
|
||||||
@@ -1755,7 +1756,7 @@ namespace BlackSimPlugin
|
|||||||
const DWORD objectId = simObject.getObjectId();
|
const DWORD objectId = simObject.getObjectId();
|
||||||
|
|
||||||
// setup
|
// setup
|
||||||
const CInterpolationAndRenderingSetupPerCallsign setup = this->getInterpolationSetupConsolidated(callsign);
|
const CInterpolationAndRenderingSetupPerCallsign setup = this->getInterpolationSetupConsolidated(callsign, updateAllAircraft);
|
||||||
const bool sendGround = setup.isSendingGndFlagToSimulator();
|
const bool sendGround = setup.isSendingGndFlagToSimulator();
|
||||||
|
|
||||||
// Interpolated situation
|
// Interpolated situation
|
||||||
@@ -1763,7 +1764,7 @@ namespace BlackSimPlugin
|
|||||||
if (result.getInterpolationStatus().hasValidSituation())
|
if (result.getInterpolationStatus().hasValidSituation())
|
||||||
{
|
{
|
||||||
// update situation
|
// update situation
|
||||||
if (setup.isForcingFullInterpolation() || !this->isEqualLastSent(result.getInterpolatedSituation()))
|
if (updateAllAircraft || setup.isForcingFullInterpolation() || !this->isEqualLastSent(result.getInterpolatedSituation()))
|
||||||
{
|
{
|
||||||
SIMCONNECT_DATA_INITPOSITION position = this->aircraftSituationToFsxPosition(result, sendGround);
|
SIMCONNECT_DATA_INITPOSITION position = this->aircraftSituationToFsxPosition(result, sendGround);
|
||||||
const HRESULT hr = this->logAndTraceSendId(
|
const HRESULT hr = this->logAndTraceSendId(
|
||||||
@@ -1796,7 +1797,7 @@ namespace BlackSimPlugin
|
|||||||
} // all callsigns
|
} // all callsigns
|
||||||
|
|
||||||
// stats
|
// stats
|
||||||
this->setStatsRemoteAircraftUpdate(currentTimestamp);
|
this->finishUpdateRemoteAircraftAndSetStatistics(currentTimestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSimulatorFsxCommon::updateRemoteAircraftParts(const CSimConnectObject &simObject, const CInterpolationResult &result)
|
bool CSimulatorFsxCommon::updateRemoteAircraftParts(const CSimConnectObject &simObject, const CInterpolationResult &result)
|
||||||
@@ -2231,7 +2232,7 @@ namespace BlackSimPlugin
|
|||||||
QTimer::singleShot(2000, this, [ = ]
|
QTimer::singleShot(2000, this, [ = ]
|
||||||
{
|
{
|
||||||
// Shutdown or unloaded
|
// Shutdown or unloaded
|
||||||
if (!sApp || sApp->isShuttingDown() || !myself) { return; }
|
if (this->isShuttingDown() || !myself) { return; }
|
||||||
m_initFsxTerrainProbes = false; // probes will re-init
|
m_initFsxTerrainProbes = false; // probes will re-init
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -2440,7 +2441,7 @@ namespace BlackSimPlugin
|
|||||||
const QPointer<CSimulatorFsxCommon> myself(this);
|
const QPointer<CSimulatorFsxCommon> myself(this);
|
||||||
QTimer::singleShot(100, this, [ = ]
|
QTimer::singleShot(100, this, [ = ]
|
||||||
{
|
{
|
||||||
if (!myself || !sApp || sApp->isShuttingDown()) { return; }
|
if (!myself || this->isShuttingDown()) { return; }
|
||||||
CSimulatorFsxCommon::physicallyRemoveAircraftNotInProvider();
|
CSimulatorFsxCommon::physicallyRemoveAircraftNotInProvider();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ namespace BlackSimPlugin
|
|||||||
CStatusMessageList CSimulatorXPlane::getInterpolationMessages(const CCallsign &callsign) const
|
CStatusMessageList CSimulatorXPlane::getInterpolationMessages(const CCallsign &callsign) const
|
||||||
{
|
{
|
||||||
if (!m_xplaneAircraftObjects.contains(callsign)) { return CStatusMessageList(); }
|
if (!m_xplaneAircraftObjects.contains(callsign)) { return CStatusMessageList(); }
|
||||||
const CInterpolationAndRenderingSetupPerCallsign setup = this->getInterpolationSetupConsolidated(callsign);
|
const CInterpolationAndRenderingSetupPerCallsign setup = this->getInterpolationSetupConsolidated(callsign, false);
|
||||||
return m_xplaneAircraftObjects[callsign].getInterpolationMessages(setup.getInterpolatorMode());
|
return m_xplaneAircraftObjects[callsign].getInterpolationMessages(setup.getInterpolatorMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -795,6 +795,7 @@ namespace BlackSimPlugin
|
|||||||
PlanesTransponders planesTransponders;
|
PlanesTransponders planesTransponders;
|
||||||
|
|
||||||
int aircraftNumber = 0;
|
int aircraftNumber = 0;
|
||||||
|
const bool updateAllAircraft = m_updateAllRemoteAircraftCycles > 0;
|
||||||
for (const CXPlaneMPAircraft &xplaneAircraft : xplaneAircraftList)
|
for (const CXPlaneMPAircraft &xplaneAircraft : xplaneAircraftList)
|
||||||
{
|
{
|
||||||
const CCallsign callsign(xplaneAircraft.getCallsign());
|
const CCallsign callsign(xplaneAircraft.getCallsign());
|
||||||
@@ -807,7 +808,7 @@ namespace BlackSimPlugin
|
|||||||
planesTransponders.modeCs.push_back(transponderMode == CTransponder::ModeC);
|
planesTransponders.modeCs.push_back(transponderMode == CTransponder::ModeC);
|
||||||
|
|
||||||
// setup
|
// setup
|
||||||
const CInterpolationAndRenderingSetupPerCallsign setup = this->getInterpolationSetupConsolidated(callsign);
|
const CInterpolationAndRenderingSetupPerCallsign setup = this->getInterpolationSetupConsolidated(callsign, updateAllAircraft);
|
||||||
|
|
||||||
// interpolated situation/parts
|
// interpolated situation/parts
|
||||||
const CInterpolationResult result = xplaneAircraft.getInterpolation(currentTimestamp, setup, aircraftNumber++);
|
const CInterpolationResult result = xplaneAircraft.getInterpolation(currentTimestamp, setup, aircraftNumber++);
|
||||||
@@ -816,7 +817,7 @@ namespace BlackSimPlugin
|
|||||||
const CAircraftSituation interpolatedSituation(result);
|
const CAircraftSituation interpolatedSituation(result);
|
||||||
|
|
||||||
// update situation
|
// update situation
|
||||||
if (!this->isEqualLastSent(interpolatedSituation))
|
if (updateAllAircraft || !this->isEqualLastSent(interpolatedSituation))
|
||||||
{
|
{
|
||||||
this->rememberLastSent(interpolatedSituation);
|
this->rememberLastSent(interpolatedSituation);
|
||||||
planesPositions.callsigns.push_back(interpolatedSituation.getCallsign().asString());
|
planesPositions.callsigns.push_back(interpolatedSituation.getCallsign().asString());
|
||||||
@@ -837,7 +838,7 @@ 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)
|
||||||
{
|
{
|
||||||
if (!this->isEqualLastSent(parts, callsign))
|
if (updateAllAircraft || !this->isEqualLastSent(parts, callsign))
|
||||||
{
|
{
|
||||||
this->rememberLastSent(parts, callsign);
|
this->rememberLastSent(parts, callsign);
|
||||||
planesSurfaces.callsigns.push_back(xplaneAircraft.getCallsign().asString());
|
planesSurfaces.callsigns.push_back(xplaneAircraft.getCallsign().asString());
|
||||||
@@ -881,7 +882,7 @@ namespace BlackSimPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// stats
|
// stats
|
||||||
this->setStatsRemoteAircraftUpdate(currentTimestamp);
|
this->finishUpdateRemoteAircraftAndSetStatistics(currentTimestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimulatorXPlane::requestRemoteAircraftDataFromXPlane()
|
void CSimulatorXPlane::requestRemoteAircraftDataFromXPlane()
|
||||||
|
|||||||
Reference in New Issue
Block a user