From 9a852b78e90a40393e6e3d3fda7d375d7f7115df Mon Sep 17 00:00:00 2001 From: Lars Toenning Date: Mon, 25 Mar 2024 21:24:43 +0100 Subject: [PATCH] refactor: Remove method without any effect This also removes a dependency of the network context from the OwnAircraft context --- .../context/contextownaircraftimpl.cpp | 42 ------------------- .../context/contextownaircraftimpl.h | 10 ----- src/blackcore/corefacade.cpp | 10 ----- 3 files changed, 62 deletions(-) diff --git a/src/blackcore/context/contextownaircraftimpl.cpp b/src/blackcore/context/contextownaircraftimpl.cpp index 16036dba6..8acdfec26 100644 --- a/src/blackcore/context/contextownaircraftimpl.cpp +++ b/src/blackcore/context/contextownaircraftimpl.cpp @@ -6,7 +6,6 @@ // ----- cross context ----- #include "blackcore/context/contextapplication.h" #include "blackcore/context/contextaudio.h" -#include "blackcore/context/contextnetwork.h" #include "blackcore/context/contextsimulator.h" // ----- cross context ----- @@ -242,39 +241,6 @@ namespace BlackCore::Context return true; } - void CContextOwnAircraft::evaluateComStations(bool atcChanged) - { - if (!sApp || sApp->isShuttingDown() || !sApp->getCContextAudioBase() || !sApp->getIContextNetwork()) { return; } - - CComSystem com1; - CComSystem com2; - CComSystem lastCom1; - CComSystem lastCom2; - { - QReadLocker l(&m_lockAircraft); - com1 = m_ownAircraft.getCom1System(); - com2 = m_ownAircraft.getCom2System(); - lastCom1 = m_lastEvaluatedCom1; - lastCom2 = m_lastEvaluatedCom2; - } - - const bool changedCom1Freq = (lastCom1.getFrequencyActive() != com1.getFrequencyActive()); - const bool changedCom2Freq = (lastCom2.getFrequencyActive() != com2.getFrequencyActive()); - - if (!atcChanged && !changedCom1Freq && !changedCom2Freq) { return; } - - const CAtcStationList atcs = sApp->getIContextNetwork()->getAtcStationsOnline(true).findInRange(); - const bool atcCom1 = atcs.hasComUnitTunedInChannelSpacing(com1); - const bool atcCom2 = atcs.hasComUnitTunedInChannelSpacing(com2); - - // remember if I was tuned in, abusing the flag - com1.setReceiveEnabled(atcCom1); - com2.setReceiveEnabled(atcCom2); - QWriteLocker l(&m_lockAircraft); - m_lastEvaluatedCom1 = com1; - m_lastEvaluatedCom2 = com1; - } - bool CContextOwnAircraft::updateOwnSituation(const CAircraftSituation &situation) { QWriteLocker l(&m_lockAircraft); @@ -339,7 +305,6 @@ namespace BlackCore::Context } if (changed) { - this->evaluateComStations(false); emit this->changedAircraftCockpit(m_ownAircraft, originator); } return changed; @@ -382,7 +347,6 @@ namespace BlackCore::Context } const bool changed = this->updateCockpit(com1, com2, xpdr, originator); - if (changed) { this->evaluateComStations(false); } return changed; } @@ -449,12 +413,6 @@ namespace BlackCore::Context return true; } - void CContextOwnAircraft::xCtxAtcStationDisconnected(const CAtcStation &atcStation) - { - Q_UNUSED(atcStation) - this->evaluateComStations(true); - } - void CContextOwnAircraft::xCtxChangedSimulatorModel(const CAircraftModel &model, const CIdentifier &identifier) { this->updateOwnModel(model, identifier); diff --git a/src/blackcore/context/contextownaircraftimpl.h b/src/blackcore/context/contextownaircraftimpl.h index 0bd9a1f7d..d3e8eb70b 100644 --- a/src/blackcore/context/contextownaircraftimpl.h +++ b/src/blackcore/context/contextownaircraftimpl.h @@ -213,15 +213,8 @@ namespace BlackCore std::atomic_bool m_history { true }; //!< enable history BlackMisc::Aviation::CAircraftSituationList m_situationHistory; //!< history, latest situation first - BlackMisc::Aviation::CComSystem m_lastEvaluatedCom1; - BlackMisc::Aviation::CComSystem m_lastEvaluatedCom2; - BlackMisc::CSetting m_currentNetworkServer { this }; - //! Station has disconnected - //! \ingroup crosscontextfunction - void xCtxAtcStationDisconnected(const BlackMisc::Aviation::CAtcStation &atcStation); - //! Simulator model has been changed //! \ingroup crosscontextfunction void xCtxChangedSimulatorModel(const BlackMisc::Simulation::CAircraftModel &model, const BlackMisc::CIdentifier &identifier); @@ -248,9 +241,6 @@ namespace BlackCore //! Update own model and emit signal with identifier bool updateOwnModel(const BlackMisc::Simulation::CAircraftModel &model, const BlackMisc::CIdentifier &identifier); - //! Evaluate COM stations - void evaluateComStations(bool atcChanged); - //! Reverse lookup of the model against DB data static BlackMisc::Simulation::CAircraftModel reverseLookupModel(const BlackMisc::Simulation::CAircraftModel &model); }; diff --git a/src/blackcore/corefacade.cpp b/src/blackcore/corefacade.cpp index 110509d1b..66e027290 100644 --- a/src/blackcore/corefacade.cpp +++ b/src/blackcore/corefacade.cpp @@ -284,16 +284,6 @@ namespace BlackCore times.insert("Post setup, sim.connects", time.restart()); } - // only where network and(!) own aircraft run locally - // -> in the core or an all local implementation - if (m_contextNetwork && m_contextOwnAircraft && m_contextNetwork->isUsingImplementingObject() && m_contextOwnAircraft->isUsingImplementingObject()) - { - c = connect(m_contextNetwork, &IContextNetwork::atcStationDisconnected, - this->getCContextOwnAircraft(), &CContextOwnAircraft::xCtxAtcStationDisconnected); - Q_ASSERT(c); - times.insert("Post setup, connects network", time.restart()); - } - // connection status of network changed // with AFV no longer use m_contextAudio->isUsingImplementingObject() as audio can run on both sides if (this->getCContextAudioBase() && m_contextNetwork)