mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Ref T182, matching log can be used with calculateScore
This commit is contained in:
@@ -576,11 +576,13 @@ namespace BlackMisc
|
||||
m_modelString.startsWith(modelString, sensitivity);
|
||||
}
|
||||
|
||||
int CAircraftModel::calculateScore(const CAircraftModel &compareModel, bool preferColorLiveries) const
|
||||
int CAircraftModel::calculateScore(const CAircraftModel &compareModel, bool preferColorLiveries, CStatusMessageList *log) const
|
||||
{
|
||||
int score = this->getAircraftIcaoCode().calculateScore(compareModel.getAircraftIcaoCode());
|
||||
score += this->getLivery().calculateScore(compareModel.getLivery(), preferColorLiveries);
|
||||
return 0.5 * score;
|
||||
const int icaoScore = this->getAircraftIcaoCode().calculateScore(compareModel.getAircraftIcaoCode());
|
||||
CMatchingUtils::addLogDetailsToList(log, this->getCallsign(), QString("ICAO score: ").arg(icaoScore));
|
||||
const int liveryScore = this->getLivery().calculateScore(compareModel.getLivery(), preferColorLiveries);
|
||||
CMatchingUtils::addLogDetailsToList(log, this->getCallsign(), QString("Livery score: ").arg(liveryScore));
|
||||
return 0.5 * (icaoScore + liveryScore);
|
||||
}
|
||||
|
||||
CStatusMessageList CAircraftModel::validate(bool withNestedObjects) const
|
||||
|
||||
@@ -364,7 +364,7 @@ namespace BlackMisc
|
||||
bool matchesModelString(const QString &modelString, Qt::CaseSensitivity sensitivity) const;
|
||||
|
||||
//! Calculate score
|
||||
int calculateScore(const CAircraftModel &compareModel, bool preferColorLiveries) const;
|
||||
int calculateScore(const CAircraftModel &compareModel, bool preferColorLiveries, CStatusMessageList *log = nullptr) const;
|
||||
|
||||
//! Validate
|
||||
CStatusMessageList validate(bool withNestedObjects) const;
|
||||
|
||||
@@ -723,7 +723,7 @@ namespace BlackMisc
|
||||
|
||||
for (const CAircraftModel &model : *this)
|
||||
{
|
||||
const int score = model.calculateScore(remoteModel, preferColorLiveries);
|
||||
const int score = model.calculateScore(remoteModel, preferColorLiveries, log);
|
||||
if (ignoreZeroScores && score < 1) { continue; }
|
||||
scoreMap.insertMulti(score, model);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user