diff --git a/src/blackcore/aircraftmatcher.cpp b/src/blackcore/aircraftmatcher.cpp index f7a519cef..380c49a53 100644 --- a/src/blackcore/aircraftmatcher.cpp +++ b/src/blackcore/aircraftmatcher.cpp @@ -822,7 +822,7 @@ namespace BlackCore { if (isDBModel) { - CMatchingUtils::addLogDetailsToList(log, callsign, QStringLiteral("Found model in DB for model string '%1'").arg(model.getModelStringAndDbKey())); + CMatchingUtils::addLogDetailsToList(log, callsign, QStringLiteral("Found model in DB for model string '%1' dist: '%2' descr.: '%3'").arg(model.getModelStringAndDbKey(), model.getDistributor().getDbKey(), model.getDescription())); } else { diff --git a/src/blackcore/airspacemonitor.cpp b/src/blackcore/airspacemonitor.cpp index 8128836ac..0f0ccd94f 100644 --- a/src/blackcore/airspacemonitor.cpp +++ b/src/blackcore/airspacemonitor.cpp @@ -510,8 +510,9 @@ namespace BlackCore // checking for min. situations ensures the aircraft is stable, can be interpolated ... const CSimulatedAircraft remoteAircraft = this->getAircraftInRangeForCallsign(callsign); const bool validCs = remoteAircraft.hasValidCallsign(); - const bool minSituations = validCs && this->remoteAircraftSituationsCount(callsign) > 1; - const bool complete = minSituations && ( + const bool minSituations = this->remoteAircraftSituationsCount(callsign) > 1; + const bool complete = validCs && + minSituations && ( (remoteAircraft.getModel().getModelType() == CAircraftModel::TypeFSInnData) || // here we know we have all data (remoteAircraft.hasModelString()) // we cannot expect more info ); @@ -749,12 +750,13 @@ namespace BlackCore emit this->requestedNewAircraft(callsign, aircraftIcaoDesignator, airlineIcaoDesignator, livery); } - CAircraftModel CAirspaceMonitor::reverseLookupModelWithFlightplanData(const CCallsign &callsign, const QString &aircraftIcaoString, - const QString &airlineIcaoString, const QString &liveryString, const QString &modelString, - CAircraftModel::ModelType type, CStatusMessageList *log, bool runMatchinScript) + CAircraftModel CAirspaceMonitor::reverseLookupModelWithFlightplanData( + const CCallsign &callsign, const QString &aircraftIcaoString, + const QString &airlineIcaoString, const QString &liveryString, const QString &modelString, + CAircraftModel::ModelType type, CStatusMessageList *log, bool runMatchinScript) { const int modelSetCount = this->getModelSetCount(); - CMatchingUtils::addLogDetailsToList(log, callsign, QStringLiteral("Reverse lookup (with FP data) model set: %1").arg(modelSetCount), CAirspaceMonitor::getLogCategories()); + CMatchingUtils::addLogDetailsToList(log, callsign, QStringLiteral("Reverse lookup (with FP data) model set count: %1").arg(modelSetCount), CAirspaceMonitor::getLogCategories()); const DBTripleIds ids = CAircraftModel::parseNetworkLiveryString(liveryString); const bool hasAnyId = ids.hasAnyId(); @@ -775,7 +777,11 @@ namespace BlackCore CAirlineIcaoCode airlineIcao; CAircraftIcaoCode aircraftIcao; - if (hasAnyId) + if (!setup.isReverseLookupSwiftLiveryIds()) + { + CMatchingUtils::addLogDetailsToList(log, callsign, QStringLiteral("Reverse lookup of livery string '%1' disabled").arg(liveryString)); + } + else if (hasAnyId) { if (ids.model >= 0) { @@ -941,7 +947,7 @@ namespace BlackCore if (!myself) { return; } myself->addNewAircraftInRange(ac); if (!readyForModelMatching) { return; } - myself->sendReadyForModelMatching(ac.getCallsign()); + myself->sendReadyForModelMatching(ac.getCallsign()); // airspace monitor adding all aicraft }); } } @@ -984,19 +990,23 @@ namespace BlackCore const CCallsign &callsign, const QString &aircraftIcao, const QString &airlineIcao, const QString &livery, const QString &modelString, CAircraftModel::ModelType modelType, CStatusMessageList *log) { - CAircraftModel model = this->reverseLookupModelWithFlightplanData(callsign, aircraftIcao, airlineIcao, livery, modelString, modelType, log); const CSimulatedAircraft aircraft = this->getAircraftInRangeForCallsign(callsign); - if (aircraft.hasValidCallsign()) { - model.updateMissingParts(aircraft.getModel()); - // Use anonymous as originator here, since the remote aircraft provider is ourselves and the call to updateAircraftModel() would - // return without doing anything. - this->updateAircraftModel(callsign, model, CIdentifier::null()); - this->updateAircraftNetworkModel(callsign, model, CIdentifier::null()); + // only if we do not have a DB model yet + if (!aircraft.getModel().hasValidDbKey()) + { + CAircraftModel model = this->reverseLookupModelWithFlightplanData(callsign, aircraftIcao, airlineIcao, livery, modelString, modelType, log); + model.updateMissingParts(aircraft.getModel()); + // Use anonymous as originator here, since the remote aircraft provider is ourselves and the call to updateAircraftModel() would + // return without doing anything. + this->updateAircraftModel(callsign, model, CIdentifier::null()); + this->updateAircraftNetworkModel(callsign, model, CIdentifier::null()); + } } else { + const CAircraftModel model = this->reverseLookupModelWithFlightplanData(callsign, aircraftIcao, airlineIcao, livery, modelString, modelType, log); const CSimulatedAircraft initAircraft(model); this->addNewAircraftInRange(initAircraft); } diff --git a/src/blackmisc/aviation/airlineicaocode.cpp b/src/blackmisc/aviation/airlineicaocode.cpp index ac166cfc2..341988335 100644 --- a/src/blackmisc/aviation/airlineicaocode.cpp +++ b/src/blackmisc/aviation/airlineicaocode.cpp @@ -202,11 +202,12 @@ namespace BlackMisc QString CAirlineIcaoCode::convertToQString(bool i18n) const { Q_UNUSED(i18n); - return this->getDesignatorDbKey() % - (this->hasName() ? u' ' % m_name : QString()) % - u" Op: " % boolToYesNo(this->isOperating()) % - u" VA: " % boolToYesNo(this->isVirtualAirline()) % - u" Mil: " % boolToYesNo(this->isMilitary()); + const QString s = this->getDesignatorDbKey() % + (this->hasName() ? u' ' % m_name : QString()) % + u" Op: " % boolToYesNo(this->isOperating()) % + u" VA: " % boolToYesNo(this->isVirtualAirline()) % + u" Mil: " % boolToYesNo(this->isMilitary()); + return s.trimmed(); } CVariant CAirlineIcaoCode::propertyByIndex(const CPropertyIndex &index) const @@ -330,7 +331,7 @@ namespace BlackMisc CAirlineIcaoCode CAirlineIcaoCode::thisOrCallsignCode(const CCallsign &callsign) const { if (this->hasValidDbKey()) { return *this; } - if (callsign.isEmpty()) { return *this; } + if (callsign.isEmpty()) { return *this; } const QString callsignAirline = callsign.getAirlinePrefix(); if (callsignAirline.isEmpty()) { return *this; } if (callsignAirline == m_designator) { return *this; } diff --git a/src/plugins/simulator/emulated/simulatoremulated.cpp b/src/plugins/simulator/emulated/simulatoremulated.cpp index 3be2f67f1..7cc6b8f80 100644 --- a/src/plugins/simulator/emulated/simulatoremulated.cpp +++ b/src/plugins/simulator/emulated/simulatoremulated.cpp @@ -214,10 +214,10 @@ namespace BlackSimPlugin bool CSimulatorEmulated::changeInternalCom(const CSimulatedAircraft &aircraft) { bool changed = false; - if (aircraft.getCom1System() != m_myAircraft.getCom1System()) { changed = true; } - if (aircraft.getCom2System() != m_myAircraft.getCom2System()) { changed = true; } + if (aircraft.getCom1System() != m_myAircraft.getCom1System()) { changed = true; } + if (aircraft.getCom2System() != m_myAircraft.getCom2System()) { changed = true; } if (aircraft.getTransponder() != m_myAircraft.getTransponder()) { changed = true; } - if (aircraft.getSelcal() != m_myAircraft.getSelcal()) { changed = true; } + if (aircraft.getSelcal() != m_myAircraft.getSelcal()) { changed = true; } if (!changed) { return false; } m_myAircraft.setCockpit(aircraft); @@ -307,6 +307,13 @@ namespace BlackSimPlugin m_renderedAircraft.push_back(aircraft); // my simulator list this->updateAircraftRendered(cs, true); // in provider emit this->aircraftRenderingChanged(aircraft); + + // debugging/logging (just here for debugging purposes) + const CAircraftModel networkModel = remoteAircraft.getNetworkModel(); + const CAircraftModel currentModel = remoteAircraft.getModel(); + Q_UNUSED(networkModel); + Q_UNUSED(currentModel); + return true; } diff --git a/src/plugins/simulator/xplane/simulatorxplane.cpp b/src/plugins/simulator/xplane/simulatorxplane.cpp index 41b087f9f..ed315e75c 100644 --- a/src/plugins/simulator/xplane/simulatorxplane.cpp +++ b/src/plugins/simulator/xplane/simulatorxplane.cpp @@ -106,7 +106,7 @@ namespace BlackSimPlugin m_pendingAddedTimer.setObjectName(this->objectName().append(":m_pendingAddedTimer")); connect(&m_fastTimer, &QTimer::timeout, this, &CSimulatorXPlane::fastTimerTimeout); connect(&m_slowTimer, &QTimer::timeout, this, &CSimulatorXPlane::slowTimerTimeout); - connect(&m_airportUpdater, &QTimer::timeout, this, &CSimulatorXPlane::updateAirportsInRange); + connect(&m_airportUpdater, &QTimer::timeout, this, &CSimulatorXPlane::updateAirportsInRange); connect(&m_pendingAddedTimer, &QTimer::timeout, this, &CSimulatorXPlane::addNextPendingAircraft); m_fastTimer.start(100); m_slowTimer.start(1000);