Ref T180, added utility function getInterpolatorInfo() allowing to log some info about interpolator

This commit is contained in:
Klaus Basan
2017-11-03 20:47:42 +01:00
parent 88872f9f3a
commit e5261c3e99
8 changed files with 53 additions and 8 deletions

View File

@@ -20,7 +20,7 @@ namespace BlackSimPlugin
CSimConnectObject::CSimConnectObject()
{ }
CSimConnectObject::CSimConnectObject(const BlackMisc::Simulation::CSimulatedAircraft &aircraft,
CSimConnectObject::CSimConnectObject(const CSimulatedAircraft &aircraft,
DWORD requestId,
CInterpolationLogger *logger) :
m_aircraft(aircraft), m_requestId(requestId), m_validRequestId(true),
@@ -92,6 +92,12 @@ namespace BlackSimPlugin
return m_interpolator->setMode(mode);
}
QString CSimConnectObject::getInterpolatorInfo() const
{
Q_ASSERT(m_interpolator);
return m_interpolator->getInterpolatorInfo();
}
bool CSimConnectObjects::setSimConnectObjectIdForRequestId(DWORD requestId, DWORD objectId, bool resetSentParts)
{
// First check, if this request id belongs to us

View File

@@ -129,6 +129,9 @@ namespace BlackSimPlugin
//! Set interpolator mode
bool setInterpolatorMode(BlackMisc::Simulation::CInterpolatorMulti::Mode mode);
//! Interpolator info
QString getInterpolatorInfo() const;
private:
BlackMisc::Simulation::CSimulatedAircraft m_aircraft; //!< corresponding aircraft
DWORD m_requestId = 0;

View File

@@ -680,17 +680,19 @@ namespace BlackSimPlugin
if (!simObject.getAircraftModelString().isEmpty())
{
m_addPendingAircraft.push_back(simObject.getAircraft());
CLogMessage(this).warning("Aircraft removed, '%1' '%2' object id '%3' out of reality bubble or other reason") << callsign.toQString() << simObject.getAircraftModelString() << objectID;
CLogMessage(this).warning("Aircraft removed, '%1' '%2' object id '%3' out of reality bubble or other reason. Interpolator: %4")
<< callsign.toQString() << simObject.getAircraftModelString()
<< objectID << simObject.getInterpolatorInfo();
}
else
{
CLogMessage(this).warning("Removed %1 from simulator, but was not initiated by us: %1 '%2' object id %3") << callsign.toQString() << simObject.getAircraftModelString() << objectID;
CLogMessage(this).warning("Removed '%1' from simulator, but was not initiated by us: %1 '%2' object id %3") << callsign.toQString() << simObject.getAircraftModelString() << objectID;
}
}
// in all cases we remove
const int c = m_simConnectObjects.remove(callsign);
const bool removed = (c > 0);
const bool removedAny = (c > 0);
const bool updated = this->updateAircraftRendered(simObject.getCallsign(), false);
if (updated)
{
@@ -702,12 +704,12 @@ namespace BlackSimPlugin
{
const CSimulatedAircraft aircraftAddAgain = m_aircraftToAddAgainWhenRemoved.findFirstByCallsign(callsign);
m_aircraftToAddAgainWhenRemoved.removeByCallsign(callsign);
QTimer::singleShot(1000, this, [ = ]
QTimer::singleShot(2500, this, [ = ]
{
this->physicallyAddRemoteAircraftImpl(aircraftAddAgain, AddedAfterRemoved);
});
}
return removed;
return removedAny;
}
bool CSimulatorFsxCommon::setSimConnectObjectId(DWORD requestId, DWORD objectId)