Ref T669, also interpolation Ref T668, remove last sent values if aircraft is removed

This commit is contained in:
Klaus Basan
2019-05-23 02:20:02 +02:00
parent 8e22bc0ced
commit 03fce676be
6 changed files with 16 additions and 10 deletions

View File

@@ -172,8 +172,7 @@ namespace BlackCore
// rendering related stuff // rendering related stuff
m_addAgainAircraftWhenRemoved.clear(); m_addAgainAircraftWhenRemoved.clear();
m_callsignsToBeRendered.clear(); m_callsignsToBeRendered.clear();
m_lastSentParts.clear(); this->resetLastSentValues(); // clear all last sent values
m_lastSentSituations.clear();
m_updateRemoteAircraftInProgress = false; m_updateRemoteAircraftInProgress = false;
this->clearInterpolationSetupsPerCallsign(); this->clearInterpolationSetupsPerCallsign();
@@ -759,6 +758,12 @@ namespace BlackCore
} }
} }
bool ISimulator::physicallyRemoveRemoteAircraft(const CCallsign &callsign)
{
this->resetLastSentValues(callsign);
return true;
}
int ISimulator::physicallyRemoveMultipleRemoteAircraft(const CCallsignSet &callsigns) int ISimulator::physicallyRemoveMultipleRemoteAircraft(const CCallsignSet &callsigns)
{ {
if (callsigns.isEmpty()) { return 0; } if (callsigns.isEmpty()) { return 0; }

View File

@@ -316,6 +316,7 @@ namespace BlackSimPlugin
m_interpolators.remove(callsign); m_interpolators.remove(callsign);
const int c = m_renderedAircraft.removeByCallsign(callsign); const int c = m_renderedAircraft.removeByCallsign(callsign);
this->updateAircraftRendered(callsign, false); // in provider this->updateAircraftRendered(callsign, false); // in provider
CSimulatorPluginCommon::physicallyRemoveRemoteAircraft(callsign);
return c > 0; return c > 0;
} }

View File

@@ -566,7 +566,7 @@ namespace BlackSimPlugin
m_pendingToBeAddedAircraft.removeByCallsign(callsign); m_pendingToBeAddedAircraft.removeByCallsign(callsign);
// bye // bye
return true; return CSimulatorPluginCommon::physicallyRemoveRemoteAircraft(callsign);
} }
int CSimulatorFlightgear::physicallyRemoveAllRemoteAircraft() int CSimulatorFlightgear::physicallyRemoveAllRemoteAircraft()

View File

@@ -199,7 +199,7 @@ namespace BlackSimPlugin
m_hashFs9Clients.remove(callsign); m_hashFs9Clients.remove(callsign);
updateAircraftRendered(callsign, false); updateAircraftRendered(callsign, false);
CLogMessage(this).info(u"FS9: Removed aircraft %1") << callsign.toQString(); CLogMessage(this).info(u"FS9: Removed aircraft %1") << callsign.toQString();
return true; return CSimulatorFsCommon::physicallyRemoveRemoteAircraft(callsign);
} }
int CSimulatorFs9::physicallyRemoveAllRemoteAircraft() int CSimulatorFs9::physicallyRemoveAllRemoteAircraft()

View File

@@ -1745,7 +1745,7 @@ namespace BlackSimPlugin
QTimer::singleShot(2000, this, [ = ] QTimer::singleShot(2000, this, [ = ]
{ {
if (!myself) { return; } if (!myself) { return; }
CLogMessage(this).info(u"Next trail to remove '%1'") << callsign.asString(); CLogMessage(this).info(u"Next trial to remove '%1'") << callsign.asString();
myself->physicallyRemoveRemoteAircraft(callsign); myself->physicallyRemoveRemoteAircraft(callsign);
}); });
return false; // not yet deleted return false; // not yet deleted
@@ -1785,7 +1785,7 @@ namespace BlackSimPlugin
this->physicallyRemoveAircraftNotInProviderAsync(); this->physicallyRemoveAircraftNotInProviderAsync();
// bye // bye
return true; return CSimulatorPluginCommon::physicallyRemoveRemoteAircraft(callsign);
} }
int CSimulatorFsxCommon::physicallyRemoveAllRemoteAircraft() int CSimulatorFsxCommon::physicallyRemoveAllRemoteAircraft()
@@ -1992,7 +1992,7 @@ namespace BlackSimPlugin
const CCallsign cs = simObject.getCallsign(); const CCallsign cs = simObject.getCallsign();
if (result.getPartsStatus().isReusedParts() || this->isEqualLastSent(parts, cs)) { return true; } if (result.getPartsStatus().isReusedParts() || this->isEqualLastSent(parts, cs)) { return true; }
DataDefinitionRemoteAircraftPartsWithoutLights ddRemoteAircraftPartsWithoutLights(parts); // no init, all values will be set DataDefinitionRemoteAircraftPartsWithoutLights ddRemoteAircraftPartsWithoutLights(parts); // all values will be set
const bool ok = this->sendRemoteAircraftPartsToSimulator(simObject, ddRemoteAircraftPartsWithoutLights, parts.getAdjustedLights()); const bool ok = this->sendRemoteAircraftPartsToSimulator(simObject, ddRemoteAircraftPartsWithoutLights, parts.getAdjustedLights());
if (ok) { this->rememberLastSent(parts, cs); } if (ok) { this->rememberLastSent(parts, cs); }
return ok; return ok;
@@ -2039,7 +2039,7 @@ namespace BlackSimPlugin
const DWORD objectId = simObject.getObjectId(); const DWORD objectId = simObject.getObjectId();
const bool traceId = this->isTracingSendId(); const bool traceId = this->isTracingSendId();
const bool simObjectAircraftType = simObject.isAircraftSimulatedObject(); const bool simObjectAircraftType = simObject.isAircraftSimulatedObject(); // no real aircraft type
// in case we sent, we sent everything // in case we sent, we sent everything
const HRESULT hr1 = simObjectAircraftType ? const HRESULT hr1 = simObjectAircraftType ?

View File

@@ -641,7 +641,7 @@ namespace BlackSimPlugin
bool CSimulatorXPlane::physicallyRemoveRemoteAircraft(const CCallsign &callsign) bool CSimulatorXPlane::physicallyRemoveRemoteAircraft(const CCallsign &callsign)
{ {
Q_ASSERT(isConnected()); Q_ASSERT(this->isConnected());
// only remove from sim // only remove from sim
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "wrong thread"); Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "wrong thread");
@@ -692,7 +692,7 @@ namespace BlackSimPlugin
m_pendingToBeAddedAircraft.removeByCallsign(callsign); m_pendingToBeAddedAircraft.removeByCallsign(callsign);
// bye // bye
return true; return CSimulatorPluginCommon::physicallyRemoveRemoteAircraft(callsign);
} }
int CSimulatorXPlane::physicallyRemoveAllRemoteAircraft() int CSimulatorXPlane::physicallyRemoveAllRemoteAircraft()