Ref T370, added public removeAllRemoteAircraft

* protected clearAllRemoteAircraftData
* ISimulator::clearAllRemoteAircraftData no longer calls clearAllRemoteAircraftData (circular)
This commit is contained in:
Klaus Basan
2018-09-25 01:46:35 +02:00
parent 24c2da67e7
commit a871579479
7 changed files with 25 additions and 9 deletions

View File

@@ -652,7 +652,7 @@ namespace BlackCore
if (m_simulatorPlugin.second) // check in case the plugin has been unloaded
{
m_simulatorPlugin.second->clearAllRemoteAircraftData(); // also removes aircraft
m_simulatorPlugin.second->removeAllRemoteAircraft(); // also removes aircraft
m_simulatorPlugin.second->setFlightNetworkConnected(false);
}
}

View File

@@ -143,7 +143,6 @@ namespace BlackCore
void ISimulator::clearAllRemoteAircraftData()
{
// rendering related stuff
this->physicallyRemoveAllRemoteAircraft();
m_addAgainAircraftWhenRemoved.clear();
m_callsignsToBeRendered.clear();
m_clampedLogMsg.clear();
@@ -698,7 +697,11 @@ namespace BlackCore
{
// a default implementation, but normally overridden by the sims
const CCallsignSet callsigns = this->getAircraftInRangeCallsigns();
// normally that would be already done in the specializied implementation
const int r = this->physicallyRemoveMultipleRemoteAircraft(callsigns);
// leave no trash
this->clearAllRemoteAircraftData();
return r;
}

View File

@@ -119,6 +119,13 @@ namespace BlackCore
//! \sa logicallyAddRemoteAircraft
virtual bool logicallyReAddRemoteAircraft(const BlackMisc::Aviation::CCallsign &callsign);
//! Public version to remove all aircraft
//! \sa physicallyRemoveAllRemoteAircraft
int removeAllRemoteAircraft()
{
return this->physicallyRemoveAllRemoteAircraft();
}
//! Find the unrendered enabled aircraft
virtual BlackMisc::Aviation::CCallsignSet unrenderedEnabledAircraft() const;
@@ -196,9 +203,6 @@ namespace BlackCore
//! Simulator running?
virtual bool isSimulating() const { return this->isConnected(); }
//! Clear all aircraft related data
virtual void clearAllRemoteAircraftData();
//! Debug function to check state after all aircraft have been removed
//! \remarks only in local developer builds
virtual BlackMisc::CStatusMessageList debugVerifyStateAfterAllAircraftRemoved() const;
@@ -400,8 +404,13 @@ namespace BlackCore
//! Remove remote aircraft from simulator
virtual int physicallyRemoveMultipleRemoteAircraft(const BlackMisc::Aviation::CCallsignSet &callsigns);
//! Remove all remote aircraft
virtual int physicallyRemoveAllRemoteAircraft() = 0;
//! Clear all aircraft related data, but do not physically remove the aircraft
virtual void clearAllRemoteAircraftData();
//! Remove all remote aircraft and their data via ISimulator::clearAllRemoteAircraftData
//! \remark each driver is supposed to override that, implement the "physically removing part" (simulator specific) and the call the base class
//! \sa ISimulator::clearAllRemoteAircraftData
virtual int physicallyRemoveAllRemoteAircraft();
//! Set elevation and CG in the providers
void rememberElevationAndCG(const BlackMisc::Aviation::CCallsign &callsign, const QString &modelString, const BlackMisc::Geo::CElevationPlane &elevation, const BlackMisc::PhysicalQuantities::CLength &cg);