mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 04:25:42 +08:00
Ref T298, better ICAO family resolution
B737/DLH searched but B738/DLH present (same family but not same ICAO)
This commit is contained in:
@@ -828,25 +828,48 @@ namespace BlackCore
|
|||||||
reduced = false;
|
reduced = false;
|
||||||
if (mode.testFlag(CAircraftMatcherSetup::ByIcaoOrderAirlineFirst))
|
if (mode.testFlag(CAircraftMatcherSetup::ByIcaoOrderAirlineFirst))
|
||||||
{
|
{
|
||||||
bool r;
|
bool r1 = false;
|
||||||
CAircraftModelList models = ifPossibleReduceByAirline(remoteAircraft, inList, "Reduce by airline first.", r, log);
|
bool r2 = false;
|
||||||
models = ifPossibleReduceByAircraftOrFamily(remoteAircraft, models, setup, "Reduce by aircraft ICAO second.", r, log);
|
CAircraftModelList models = ifPossibleReduceByAirline(remoteAircraft, inList, "Reduce by airline first.", r1, log);
|
||||||
reduced = r;
|
models = ifPossibleReduceByAircraftOrFamily(remoteAircraft, models, setup, "Reduce by aircraft ICAO second.", r2, log);
|
||||||
|
reduced = r1 || r2;
|
||||||
if (reduced) { return models; }
|
if (reduced) { return models; }
|
||||||
}
|
}
|
||||||
else if (mode.testFlag(CAircraftMatcherSetup::ByIcaoData))
|
else if (mode.testFlag(CAircraftMatcherSetup::ByIcaoData))
|
||||||
{
|
{
|
||||||
bool r;
|
bool r1 = false;
|
||||||
CAircraftModelList models = ifPossibleReduceByAircraftOrFamily(remoteAircraft, inList, setup, "Reduce by aircraft ICAO first.", r, log);
|
bool r2 = false;
|
||||||
models = ifPossibleReduceByAirline(remoteAircraft, models, "Reduce by airline second.", r, log);
|
CAircraftModelList models = ifPossibleReduceByAircraftOrFamily(remoteAircraft, inList, setup, "Reduce by aircraft ICAO first.", r1, log);
|
||||||
reduced = r;
|
models = ifPossibleReduceByAirline(remoteAircraft, models, "Reduce aircraft ICAO by airline second.", r2, log);
|
||||||
if (reduced) { return models; }
|
|
||||||
}
|
// not finding anything so far means we have no valid aircraft/airline ICAO combination
|
||||||
else
|
// but it can happen we found B738, and for DLH there is no B738 but B737, so we search again
|
||||||
|
if (!r2 && mode.testFlag(CAircraftMatcherSetup::ByFamily))
|
||||||
{
|
{
|
||||||
if (log) { CMatchingUtils::addLogDetailsToList(log, remoteAircraft, "No reduction by ICAO data", getLogCategories()); }
|
if (log) { CMatchingUtils::addLogDetailsToList(log, remoteAircraft, QStringLiteral("No exact ICAO match of '") % remoteAircraft.getAirlineAndAircraftIcaoCodeDesignators() % QStringLiteral("', will try family combination"), getLogCategories()); }
|
||||||
|
|
||||||
|
bool r3 = false;
|
||||||
|
CAircraftModelList models2nd = ifPossibleReduceByFamily(remoteAircraft, inList, r3, log);
|
||||||
|
models2nd = ifPossibleReduceByAirline(remoteAircraft, models2nd, "Reduce family by airline second.", r3, log);
|
||||||
|
if (r3)
|
||||||
|
{
|
||||||
|
// we found family / airline combination
|
||||||
|
if (log) { CMatchingUtils::addLogDetailsToList(log, remoteAircraft, QStringLiteral("Found aircraft family/airline '") % QStringLiteral("'combination"), getLogCategories()); }
|
||||||
|
return models;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (log) { CMatchingUtils::addLogDetailsToList(log, remoteAircraft, QStringLiteral("Found aircraft family/airline '") % remoteAircraft.getAircraftIcaoCode().getFamily() % QStringLiteral("/") % remoteAircraft.getAirlineIcaoCodeDesignator() % QStringLiteral("'combination"), getLogCategories()); }
|
||||||
|
|
||||||
|
reduced = r1 || r2;
|
||||||
|
if (reduced)
|
||||||
|
{
|
||||||
|
if (log) { CMatchingUtils::addLogDetailsToList(log, remoteAircraft, QStringLiteral("Reduced by aircraft ICAO: ") % boolToYesNo(r1) % QStringLiteral(" airline: ") % boolToYesNo(r2), getLogCategories()); }
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (log) { CMatchingUtils::addLogDetailsToList(log, remoteAircraft, "No reduction by ICAO data", getLogCategories()); }
|
||||||
return inList;
|
return inList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -141,6 +141,13 @@ namespace BlackMisc
|
|||||||
return getAircraftIcaoCode().getDesignator();
|
return getAircraftIcaoCode().getDesignator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString CSimulatedAircraft::getAirlineAndAircraftIcaoCodeDesignators() const
|
||||||
|
{
|
||||||
|
if (this->hasAircraftAndAirlineDesignator()) { return this->getAircraftIcaoCodeDesignator() % QStringLiteral("/") % this->getAirlineIcaoCodeDesignator(); }
|
||||||
|
if (this->hasAirlineDesignator()) { return this->getAirlineIcaoCodeDesignator(); }
|
||||||
|
return this->getAircraftIcaoCodeDesignator();
|
||||||
|
}
|
||||||
|
|
||||||
const QString &CSimulatedAircraft::getAircraftIcaoCombinedType() const
|
const QString &CSimulatedAircraft::getAircraftIcaoCombinedType() const
|
||||||
{
|
{
|
||||||
return getAircraftIcaoCode().getCombinedType();
|
return getAircraftIcaoCode().getCombinedType();
|
||||||
|
|||||||
@@ -131,6 +131,9 @@ namespace BlackMisc
|
|||||||
//! Aircraft ICAO code designator
|
//! Aircraft ICAO code designator
|
||||||
const QString &getAircraftIcaoCodeDesignator() const;
|
const QString &getAircraftIcaoCodeDesignator() const;
|
||||||
|
|
||||||
|
//! Aircraft and Airline ICAO code designators
|
||||||
|
QString getAirlineAndAircraftIcaoCodeDesignators() const;
|
||||||
|
|
||||||
//! Aircraft ICAO combined code
|
//! Aircraft ICAO combined code
|
||||||
const QString &getAircraftIcaoCombinedType() const;
|
const QString &getAircraftIcaoCombinedType() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user