diff --git a/src/blackcore/airspace_monitor.cpp b/src/blackcore/airspace_monitor.cpp index 2551fdbde..5d0ef835b 100644 --- a/src/blackcore/airspace_monitor.cpp +++ b/src/blackcore/airspace_monitor.cpp @@ -341,6 +341,26 @@ namespace BlackCore } } + void CAirspaceMonitor::removeAllAtcStations() + { + m_atcWatchdog.removeAll(); + m_atcStationsOnline.clear(); + } + + void CAirspaceMonitor::removeAllAircrafts() + { + m_aircraftWatchdog.removeAll(); + for(CAircraft aircraft : m_aircraftsInRange) + emit removedAircraft(aircraft.getCallsign()); + + m_aircraftsInRange.clear(); + } + + void CAirspaceMonitor::removeAllOtherClients() + { + m_otherClients.clear(); + } + void CAirspaceMonitor::ps_receivedBookings(const CAtcStationList &bookedStations) { Q_ASSERT(BlackCore::isCurrentThreadCreatingThread(this)); diff --git a/src/blackcore/airspace_monitor.h b/src/blackcore/airspace_monitor.h index 7fa294bd3..71723d0cc 100644 --- a/src/blackcore/airspace_monitor.h +++ b/src/blackcore/airspace_monitor.h @@ -112,10 +112,9 @@ namespace BlackCore //! Clear the contents void clear() { - m_atcStationsOnline.clear(); - m_atcStationsBooked.clear(); - m_aircraftsInRange.clear(); - m_otherClients.clear(); + removeAllAtcStations(); + removeAllAircrafts(); + removeAllOtherClients(); m_metarCache.clear(); m_flightPlanCache.clear(); } @@ -145,6 +144,10 @@ namespace BlackCore //! Helper method, add voice capabilites if available void addVoiceCapabilitiesFromDataFile(BlackMisc::CPropertyIndexVariantMap &vm, const BlackMisc::Aviation::CCallsign &callsign); + void removeAllAtcStations(); + void removeAllAircrafts(); + void removeAllOtherClients(); + private slots: void ps_realNameReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &realname); void ps_capabilitiesReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, quint32 flags);