Ref T370, remove models from FSX/P3D

* clearAllRemoteAircraftData also removes aircraft (from simulator)
* debugVerifyStateAfterAllAircraftRemoved only makes sense if removing aircraft and then emit the messages
This commit is contained in:
Klaus Basan
2018-09-23 03:23:05 +02:00
parent 4dcb2185b4
commit 527f666d1f
4 changed files with 10 additions and 14 deletions

View File

@@ -652,10 +652,8 @@ namespace BlackCore
if (m_simulatorPlugin.second) // check in case the plugin has been unloaded
{
const CStatusMessageList verifyMessages = m_simulatorPlugin.second->debugVerifyStateAfterAllAircraftRemoved();
m_simulatorPlugin.second->clearAllRemoteAircraftData();
m_simulatorPlugin.second->clearAllRemoteAircraftData(); // also removes aircraft
m_simulatorPlugin.second->setFlightNetworkConnected(false);
if (!verifyMessages.isEmpty()) { emit this->driverMessages(verifyMessages); }
}
}
}

View File

@@ -251,7 +251,7 @@ namespace BlackCore
bool m_enableMatchingMessages = true;
bool m_isWeatherActivated = false;
QString m_networkSessionId; //!< Network session of CServer::getServerSessionId, if not connected empty
QString m_networkSessionId; //!< Network session of CServer::getServerSessionId, if not connected empty (for statistics, ..)
// settings
BlackMisc::CSettingReadOnly<Application::TEnabledSimulators> m_enabledSimulators { this, &CContextSimulator::changeEnabledSimulators };

View File

@@ -143,6 +143,7 @@ namespace BlackCore
void ISimulator::clearAllRemoteAircraftData()
{
// rendering related stuff
this->physicallyRemoveAllRemoteAircraft();
m_addAgainAircraftWhenRemoved.clear();
m_callsignsToBeRendered.clear();
m_clampedLogMsg.clear();
@@ -695,7 +696,6 @@ namespace BlackCore
// a default implementation, but normally overridden by the sims
const CCallsignSet callsigns = this->getAircraftInRangeCallsigns();
const int r = this->physicallyRemoveMultipleRemoteAircraft(callsigns);
this->debugVerifyStateAfterAllAircraftRemoved();
this->clearAllRemoteAircraftData();
return r;
}

View File

@@ -263,7 +263,7 @@ namespace BlackSimPlugin
CStatusMessageList CSimulatorFsxCommon::debugVerifyStateAfterAllAircraftRemoved() const
{
CStatusMessageList msgs;
if (CBuildConfig::isLocalDeveloperDebugBuild()) { return msgs; }
if (!CBuildConfig::isLocalDeveloperDebugBuild()) { return msgs; }
msgs = CSimulatorFsCommon::debugVerifyStateAfterAllAircraftRemoved();
if (!m_simConnectObjects.isEmpty()) { msgs.push_back(CStatusMessage(this).error("m_simConnectObjects not empty: '%1'") << m_simConnectObjects.getAllCallsignStringsAsString(true)); }
if (!m_simConnectObjectsPositionAndPartsTraces.isEmpty()) { msgs.push_back(CStatusMessage(this).error("m_simConnectObjectsPositionAndPartsTraces not empty: '%1'") << m_simConnectObjectsPositionAndPartsTraces.getAllCallsignStringsAsString(true)); }
@@ -1473,10 +1473,7 @@ namespace BlackSimPlugin
if (!m_simConnectObjects.contains(callsign)) { return false; } // already fully removed or not yet added
CSimConnectObject &simObject = m_simConnectObjects[callsign];
if (simObject.isPendingRemoved()) { return true; }
if (simObject.isTerrainProbe())
{
return false;
}
if (simObject.isTerrainProbe()) { return false; }
// check for pending objects
m_addPendingAircraft.remove(callsign); // just in case still in list of pending aircraft
@@ -2088,9 +2085,9 @@ namespace BlackSimPlugin
void CSimulatorFsxCommon::reset()
{
this->safeKillTimer();
this->removeAllProbes(); // still requires connection
// cleared below:
// physicallyRemoveAllRemoteAircraft
// m_simConnectObjects
// m_simConnectObjectsPositionAndPartsTraces
// m_addPendingAircraft
@@ -2114,12 +2111,13 @@ namespace BlackSimPlugin
void CSimulatorFsxCommon::clearAllRemoteAircraftData()
{
this->removeAllProbes();
// m_addAgainAircraftWhenRemoved cleared below
CSimulatorFsCommon::clearAllRemoteAircraftData(); // also removes aircraft
m_simConnectObjects.clear();
m_addPendingAircraft.clear();
m_simConnectObjectsPositionAndPartsTraces.clear();
this->removeAllProbes();
// m_addAgainAircraftWhenRemoved cleared below
CSimulatorFsCommon::clearAllRemoteAircraftData();
}
QString CSimulatorFsxCommon::fsxPositionToString(const SIMCONNECT_DATA_INITPOSITION &position)