mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 21:15:33 +08:00
Ref T348, remove from matcher if model failed
This commit is contained in:
@@ -665,6 +665,21 @@ namespace BlackCore
|
||||
m_statistics.addAircraftAirlineCombination(type, sessionId, m_modelSetInfo, description, aircraftIcao, airlineIcao);
|
||||
}
|
||||
|
||||
void CAircraftMatcher::addingRemoteModelFailed(const CSimulatedAircraft &remoteAircraft)
|
||||
{
|
||||
if (!m_setup.removeFromSetIfFailed()) { return; }
|
||||
if (remoteAircraft.hasCallsign() && remoteAircraft.hasModelString())
|
||||
{
|
||||
const QString modelString = remoteAircraft.getModelString();
|
||||
const int r = m_modelSet.removeModelWithString(modelString, Qt::CaseInsensitive);
|
||||
if (r > 0)
|
||||
{
|
||||
CLogMessage(this).warning("Removed model '%1' from matching model set") << modelString;
|
||||
m_removedModels.insert(modelString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CAircraftModelList CAircraftMatcher::getClosestMatchStepwiseReduceImplementation(const CAircraftModelList &modelSet, const CAircraftMatcherSetup &setup, const CSimulatedAircraft &remoteAircraft, CStatusMessageList *log)
|
||||
{
|
||||
CAircraftModelList matchedModels(modelSet);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QPair>
|
||||
#include <QSet>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -175,6 +176,9 @@ namespace BlackCore
|
||||
//! Evaluate if a statistics entry makes sense and add it
|
||||
void evaluateStatisticsEntry(const QString &sessionId, const BlackMisc::Aviation::CCallsign &callsign, const QString &aircraftIcao, const QString &airlineIcao, const QString &livery);
|
||||
|
||||
//! Adding a model failed
|
||||
void addingRemoteModelFailed(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft);
|
||||
|
||||
signals:
|
||||
//! Setup changed
|
||||
void setupChanged();
|
||||
@@ -261,6 +265,7 @@ namespace BlackCore
|
||||
BlackMisc::Simulation::CSimulatorInfo m_simulator; //!< simulator (optional)
|
||||
BlackMisc::Simulation::CMatchingStatistics m_statistics; //!< matching statistics
|
||||
QString m_modelSetInfo; //!< info string
|
||||
QSet<QString> m_removedModels; //!< models have been removed
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -663,6 +663,7 @@ namespace BlackCore
|
||||
void CContextSimulator::onAddingRemoteAircraftFailed(const CSimulatedAircraft &remoteAircraft, bool disabled, const CStatusMessage &message)
|
||||
{
|
||||
if (!this->isSimulatorAvailable()) { return; }
|
||||
if (disabled) { m_aircraftMatcher.addingRemoteModelFailed(remoteAircraft); }
|
||||
emit this->addingRemoteModelFailed(remoteAircraft, disabled, message);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user