mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 11:05:33 +08:00
Moved smart selector functions to lists
This commit is contained in:
committed by
Mathew Sutcliffe
parent
5e42aa0b95
commit
955b8bafea
@@ -51,5 +51,32 @@ namespace BlackMisc
|
||||
});
|
||||
}
|
||||
|
||||
CLivery CLiveryList::smartLiverySelector(const CLivery &liveryPattern) const
|
||||
{
|
||||
// first try on id, that would be perfect
|
||||
if (liveryPattern.hasValidDbKey())
|
||||
{
|
||||
int k = liveryPattern.getDbKey();
|
||||
CLivery l(this->findByKey(k));
|
||||
if (l.hasCompleteData()) { return l; }
|
||||
}
|
||||
|
||||
// by combined code
|
||||
if (liveryPattern.hasCombinedCode())
|
||||
{
|
||||
QString cc(liveryPattern.getCombinedCode());
|
||||
CLivery l(this->findByCombinedCode(cc));
|
||||
if (l.hasCompleteData()) { return l; }
|
||||
}
|
||||
|
||||
if (liveryPattern.hasValidAirlineDesignator())
|
||||
{
|
||||
QString icao(liveryPattern.getAirlineIcaoCodeDesignator());
|
||||
CLivery l(this->findByAirlineIcaoDesignatorStdLivery(icao));
|
||||
if (l.hasCompleteData()) { return l; }
|
||||
}
|
||||
return CLivery();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user