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 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); m_simulatorPlugin.second->setFlightNetworkConnected(false);
} }
} }

View File

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

View File

@@ -119,6 +119,13 @@ namespace BlackCore
//! \sa logicallyAddRemoteAircraft //! \sa logicallyAddRemoteAircraft
virtual bool logicallyReAddRemoteAircraft(const BlackMisc::Aviation::CCallsign &callsign); 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 //! Find the unrendered enabled aircraft
virtual BlackMisc::Aviation::CCallsignSet unrenderedEnabledAircraft() const; virtual BlackMisc::Aviation::CCallsignSet unrenderedEnabledAircraft() const;
@@ -196,9 +203,6 @@ namespace BlackCore
//! Simulator running? //! Simulator running?
virtual bool isSimulating() const { return this->isConnected(); } 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 //! Debug function to check state after all aircraft have been removed
//! \remarks only in local developer builds //! \remarks only in local developer builds
virtual BlackMisc::CStatusMessageList debugVerifyStateAfterAllAircraftRemoved() const; virtual BlackMisc::CStatusMessageList debugVerifyStateAfterAllAircraftRemoved() const;
@@ -400,8 +404,13 @@ namespace BlackCore
//! Remove remote aircraft from simulator //! Remove remote aircraft from simulator
virtual int physicallyRemoveMultipleRemoteAircraft(const BlackMisc::Aviation::CCallsignSet &callsigns); virtual int physicallyRemoveMultipleRemoteAircraft(const BlackMisc::Aviation::CCallsignSet &callsigns);
//! Remove all remote aircraft //! Clear all aircraft related data, but do not physically remove the aircraft
virtual int physicallyRemoveAllRemoteAircraft() = 0; 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 //! 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); void rememberElevationAndCG(const BlackMisc::Aviation::CCallsign &callsign, const QString &modelString, const BlackMisc::Geo::CElevationPlane &elevation, const BlackMisc::PhysicalQuantities::CLength &cg);

View File

@@ -213,6 +213,8 @@ namespace BlackSimPlugin
{ {
if (physicallyRemoveRemoteAircraft(cs)) { r++; } if (physicallyRemoveRemoteAircraft(cs)) { r++; }
} }
CSimulatorFsCommon::physicallyRemoveAllRemoteAircraft();
return r; return r;
} }

View File

@@ -1548,6 +1548,8 @@ namespace BlackSimPlugin
{ {
if (this->physicallyRemoveRemoteAircraft(cs)) { r++; } if (this->physicallyRemoveRemoteAircraft(cs)) { r++; }
} }
CSimulatorFsCommon::physicallyRemoveAllRemoteAircraft();
return r; return r;
} }

View File

@@ -144,7 +144,6 @@ namespace BlackSimPlugin
virtual void displayTextMessage(const BlackMisc::Network::CTextMessage &message) const override; virtual void displayTextMessage(const BlackMisc::Network::CTextMessage &message) const override;
virtual bool isPhysicallyRenderedAircraft(const BlackMisc::Aviation::CCallsign &callsign) const override; virtual bool isPhysicallyRenderedAircraft(const BlackMisc::Aviation::CCallsign &callsign) const override;
virtual BlackMisc::Aviation::CCallsignSet physicallyRenderedAircraft() const override; virtual BlackMisc::Aviation::CCallsignSet physicallyRenderedAircraft() const override;
virtual void clearAllRemoteAircraftData() override;
virtual BlackMisc::CStatusMessageList debugVerifyStateAfterAllAircraftRemoved() const override; virtual BlackMisc::CStatusMessageList debugVerifyStateAfterAllAircraftRemoved() const override;
virtual QString getStatisticsSimulatorSpecific() const override; virtual QString getStatisticsSimulatorSpecific() const override;
virtual void resetAircraftStatistics() override; virtual void resetAircraftStatistics() override;
@@ -207,6 +206,7 @@ namespace BlackSimPlugin
virtual void reset() override; virtual void reset() override;
virtual void initSimulatorInternals() override; virtual void initSimulatorInternals() override;
virtual void injectWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid) override; virtual void injectWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid) override;
virtual void clearAllRemoteAircraftData() override;
//! @} //! @}
//! Timer event (our SimConnect event loop), runs dispatch //! Timer event (our SimConnect event loop), runs dispatch

View File

@@ -138,7 +138,6 @@ namespace BlackSimPlugin
virtual void unload() override; virtual void unload() override;
virtual QString getStatisticsSimulatorSpecific() const override; virtual QString getStatisticsSimulatorSpecific() const override;
virtual void resetAircraftStatistics() override; virtual void resetAircraftStatistics() override;
virtual void clearAllRemoteAircraftData() override;
//! @} //! @}
//! \copydoc BlackMisc::Simulation::ISimulationEnvironmentProvider::requestElevation //! \copydoc BlackMisc::Simulation::ISimulationEnvironmentProvider::requestElevation
@@ -154,6 +153,7 @@ namespace BlackSimPlugin
virtual bool physicallyAddRemoteAircraft(const BlackMisc::Simulation::CSimulatedAircraft &newRemoteAircraft) override; virtual bool physicallyAddRemoteAircraft(const BlackMisc::Simulation::CSimulatedAircraft &newRemoteAircraft) override;
virtual bool physicallyRemoveRemoteAircraft(const BlackMisc::Aviation::CCallsign &callsign) override; virtual bool physicallyRemoveRemoteAircraft(const BlackMisc::Aviation::CCallsign &callsign) override;
virtual int physicallyRemoveAllRemoteAircraft() override; virtual int physicallyRemoveAllRemoteAircraft() override;
virtual void clearAllRemoteAircraftData() override;
virtual void injectWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid) override; virtual void injectWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid) override;
virtual bool isPaused() const override virtual bool isPaused() const override
{ {