refactor: Remove method without any effect

This also removes a dependency of the network context from the
OwnAircraft context
This commit is contained in:
Lars Toenning
2024-03-25 21:24:43 +01:00
parent b6867445fa
commit 9a852b78e9
3 changed files with 0 additions and 62 deletions

View File

@@ -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);

View File

@@ -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<BlackMisc::Network::Settings::TCurrentTrafficServer> 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);
};

View File

@@ -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)