mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 03:15:34 +08:00
Ref T180, formatting
This commit is contained in:
@@ -40,7 +40,7 @@ namespace BlackMisc
|
||||
static QString getLogCategory() { return "swift.interpolationlogger"; }
|
||||
|
||||
//! Write a log in background
|
||||
BlackMisc::CWorker *writeLogInBackground();
|
||||
CWorker *writeLogInBackground();
|
||||
|
||||
//! Clear log file
|
||||
void clearLog();
|
||||
|
||||
@@ -38,7 +38,8 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
CAircraftParts CInterpolatorMulti::getInterpolatedParts(
|
||||
qint64 currentTimeSinceEpoc, const CInterpolationAndRenderingSetup &setup, CPartsStatus &partsStatus, bool log)
|
||||
qint64 currentTimeSinceEpoc, const CInterpolationAndRenderingSetup &setup,
|
||||
CPartsStatus &partsStatus, bool log)
|
||||
{
|
||||
switch (m_mode)
|
||||
{
|
||||
|
||||
@@ -28,28 +28,28 @@ namespace BlackMisc
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
CInterpolatorMulti(const BlackMisc::Aviation::CCallsign &callsign, QObject *parent = nullptr);
|
||||
CInterpolatorMulti(const Aviation::CCallsign &callsign, QObject *parent = nullptr);
|
||||
|
||||
//! \copydoc CInterpolator::getInterpolatedSituation
|
||||
BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation(
|
||||
Aviation::CAircraftSituation getInterpolatedSituation(
|
||||
qint64 currentTimeSinceEpoc,
|
||||
const CInterpolationAndRenderingSetup &setup,
|
||||
const CInterpolationHints &hints, CInterpolationStatus &status);
|
||||
|
||||
//! \copydoc CInterpolator::getInterpolatedParts
|
||||
BlackMisc::Aviation::CAircraftParts getInterpolatedParts(
|
||||
Aviation::CAircraftParts getInterpolatedParts(
|
||||
qint64 currentTimeSinceEpoc,
|
||||
const CInterpolationAndRenderingSetup &setup,
|
||||
CPartsStatus &partsStatus, bool log = false);
|
||||
|
||||
//! \copydoc CInterpolator::addAircraftSituation
|
||||
void addAircraftSituation(const BlackMisc::Aviation::CAircraftSituation &situation);
|
||||
void addAircraftSituation(const Aviation::CAircraftSituation &situation);
|
||||
|
||||
//! \copydoc CInterpolator::hasAircraftSituations
|
||||
bool hasAircraftSituations() const;
|
||||
|
||||
//! \copydoc CInterpolator::addAircraftParts
|
||||
void addAircraftParts(const BlackMisc::Aviation::CAircraftParts &parts);
|
||||
void addAircraftParts(const Aviation::CAircraftParts &parts);
|
||||
|
||||
//! \copydoc CInterpolator::hasAircraftParts
|
||||
bool hasAircraftParts() const;
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace BlackSimPlugin
|
||||
|
||||
CCallsign CSimConnectObjects::getCallsignForObjectId(DWORD objectId) const
|
||||
{
|
||||
return getSimObjectForObjectId(objectId).getCallsign();
|
||||
return this->getSimObjectForObjectId(objectId).getCallsign();
|
||||
}
|
||||
|
||||
CCallsignSet CSimConnectObjects::getAllCallsigns() const
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace BlackSimPlugin
|
||||
//! Constructor
|
||||
CSimConnectObject();
|
||||
|
||||
//! Constructor, providing initial situation/parts
|
||||
//! Constructor providing initial situation/parts
|
||||
CSimConnectObject(const BlackMisc::Simulation::CSimulatedAircraft &aircraft,
|
||||
DWORD requestId,
|
||||
BlackMisc::Simulation::CInterpolationLogger *logger);
|
||||
@@ -99,7 +99,7 @@ namespace BlackSimPlugin
|
||||
//! Valid object id?
|
||||
bool hasValidObjectId() const { return m_validObjectId; }
|
||||
|
||||
//! Object is requested, not yet added
|
||||
//! Object is requested in simulator, not yet confirmed added
|
||||
bool isPendingAdded() const;
|
||||
|
||||
//! Adding is confirmed
|
||||
@@ -117,28 +117,30 @@ namespace BlackSimPlugin
|
||||
//! VTOL?
|
||||
bool isVtol() const { return m_aircraft.isVtol(); }
|
||||
|
||||
//! Was the object really added to SIM
|
||||
//! Was the object really added to simulator
|
||||
bool hasValidRequestAndObjectId() const;
|
||||
|
||||
//! Toggle interpolator mode
|
||||
//! \copydoc BlackMisc::Simulation::CInterpolatorMulti::toggleMode
|
||||
void toggleInterpolatorMode();
|
||||
|
||||
//! Set interpolator mode
|
||||
//! \copydoc BlackMisc::Simulation::CInterpolatorMulti::setMode
|
||||
bool setInterpolatorMode(BlackMisc::Simulation::CInterpolatorMulti::Mode mode);
|
||||
|
||||
//! Interpolator info
|
||||
//! \copydoc BlackMisc::Simulation::CInterpolator::getInterpolatorInfo
|
||||
QString getInterpolatorInfo() const;
|
||||
|
||||
//! Interpolator
|
||||
BlackMisc::Simulation::CInterpolatorMulti *getInterpolator() const { return m_interpolator.data(); }
|
||||
//! \copydoc BlackMisc::Simulation::CInterpolator::attachLogger
|
||||
void attachInterpolatorLogger(BlackMisc::Simulation::CInterpolationLogger *logger);
|
||||
|
||||
//! Get interpolated situation
|
||||
//! \remark return original position if interpolation fails for some reason
|
||||
//! \copydoc BlackMisc::Simulation::CInterpolator::getInterpolatedSituation
|
||||
BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation(
|
||||
qint64 currentTimeSinceEpoc,
|
||||
const BlackMisc::Simulation::CInterpolationAndRenderingSetup &setup,
|
||||
const BlackMisc::Simulation::CInterpolationHints &hints, BlackMisc::Simulation::CInterpolationStatus &status) const;
|
||||
|
||||
//! Interpolator
|
||||
BlackMisc::Simulation::CInterpolatorMulti *getInterpolator() const { return m_interpolator.data(); }
|
||||
|
||||
private:
|
||||
BlackMisc::Simulation::CSimulatedAircraft m_aircraft; //!< corresponding aircraft
|
||||
DWORD m_requestId = 0;
|
||||
|
||||
@@ -508,7 +508,7 @@ namespace BlackSimPlugin
|
||||
// we know the object has been created. But it can happen it is directly removed afterwards
|
||||
QTimer::singleShot(500, this, [ = ]
|
||||
{
|
||||
// also triggers new add
|
||||
// also triggers new add if required
|
||||
this->verifyAddedRemoteAircraft(simObject.getAircraft());
|
||||
});
|
||||
return true;
|
||||
@@ -1059,8 +1059,10 @@ namespace BlackSimPlugin
|
||||
static_assert(sizeof(DataDefinitionRemoteAircraftPartsWithoutLights) == sizeof(double) * 10, "DataDefinitionRemoteAircraftPartsWithoutLights has an incorrect size.");
|
||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "thread");
|
||||
|
||||
// Freeze interpolation while paused
|
||||
if (this->isPaused() && m_pausedSimFreezesInterpolation) { return; }
|
||||
|
||||
// nothing to do, reset request id and exit
|
||||
if (this->isPaused() && m_pausedSimFreezesInterpolation) { return; } // no interpolation while paused
|
||||
const int remoteAircraftNo = this->getAircraftInRangeCount();
|
||||
if (remoteAircraftNo < 1) { m_interpolationRequest = 0; return; }
|
||||
|
||||
@@ -1071,10 +1073,10 @@ namespace BlackSimPlugin
|
||||
|
||||
// values used for position and parts
|
||||
const qint64 currentTimestamp = QDateTime::currentMSecsSinceEpoch();
|
||||
const QList<CSimConnectObject> simObjects(m_simConnectObjects.values());
|
||||
const CCallsignSet callsignsToLog(m_interpolationRenderingSetup.getLogCallsigns());
|
||||
|
||||
// interpolation for all remote aircraft
|
||||
const QList<CSimConnectObject> simObjects(m_simConnectObjects.values());
|
||||
for (const CSimConnectObject &simObject : simObjects)
|
||||
{
|
||||
// happening if aircraft is not yet added to simulator or to be deleted
|
||||
@@ -1089,7 +1091,7 @@ namespace BlackSimPlugin
|
||||
// fetch parts, as they are needed for ground interpolation
|
||||
const bool useAircraftParts = enableAircraftParts && aircraftWithParts.contains(callsign);
|
||||
const bool logInterpolationAndParts = callsignsToLog.contains(callsign);
|
||||
const CInterpolationAndRenderingSetup setup(getInterpolationAndRenderingSetup());
|
||||
const CInterpolationAndRenderingSetup setup(this->getInterpolationAndRenderingSetup());
|
||||
CPartsStatus partsStatus(useAircraftParts);
|
||||
const CAircraftParts parts = useAircraftParts ? simObject.getInterpolator()->getInterpolatedParts(-1, setup, partsStatus, logInterpolationAndParts) : CAircraftParts();
|
||||
|
||||
@@ -1110,7 +1112,7 @@ namespace BlackSimPlugin
|
||||
sizeof(SIMCONNECT_DATA_INITPOSITION), &position);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
if (m_traceSendId) { this->traceSendId(simObject.getObjectId(), Q_FUNC_INFO);}
|
||||
if (m_traceSendId) { this->traceSendId(simObject.getObjectId(), Q_FUNC_INFO); }
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1565,7 +1567,7 @@ namespace BlackSimPlugin
|
||||
if (toBeRemoved.isEmpty()) { return toBeRemoved; }
|
||||
for (const CCallsign &callsign : toBeRemoved)
|
||||
{
|
||||
physicallyRemoveRemoteAircraft(callsign);
|
||||
this->physicallyRemoveRemoteAircraft(callsign);
|
||||
}
|
||||
|
||||
if (this->showDebugLogMessage()) { this->debugLogMessage(Q_FUNC_INFO, QString("Cs: '%1'").arg(toBeRemoved.toStringList().join(", "))); }
|
||||
|
||||
@@ -299,7 +299,7 @@ namespace BlackSimPlugin
|
||||
//! Request data for a simObject (aka remote aircraft)
|
||||
bool requestDataForSimObject(const CSimConnectObject &simObject, SIMCONNECT_PERIOD period = SIMCONNECT_PERIOD_SECOND);
|
||||
|
||||
//! Request lights for a simObject
|
||||
//! Request lights for a CSimConnectObject
|
||||
bool requestLightsForSimObject(const CSimConnectObject &simObject);
|
||||
|
||||
//! FSX position as string
|
||||
|
||||
Reference in New Issue
Block a user