Ref T515, logic for "isLikely" simulator list moved to model list

This commit is contained in:
Klaus Basan
2019-01-19 12:43:43 +01:00
committed by Mat Sutcliffe
parent 11daf3b418
commit 77e642d42d
3 changed files with 39 additions and 5 deletions

View File

@@ -557,6 +557,34 @@ namespace BlackMisc
return CSimulatorInfo(s);
}
namespace Private
{
bool isLikelyImpl(double count, double total)
{
if (total < 1) { return false; }
const double fsRatio = count / total;
return fsRatio > 0.95;
}
}
bool CAircraftModelList::isLikelyFsFamilyModelList() const
{
if (this->isEmpty()) { return false; } // avoid DIV 0
return Private::isLikelyImpl(this->countPerSimulator().getCountForFsFamilySimulators(), this->size());
}
bool CAircraftModelList::isLikelyFsxFamilyModelList() const
{
if (this->isEmpty()) { return false; } // avoid DIV 0
return Private::isLikelyImpl(this->countPerSimulator().getCountForFsxFamilySimulators(), this->size());
}
bool CAircraftModelList::isLikelyXplaneModelList() const
{
if (this->isEmpty()) { return false; } // avoid DIV 0
return Private::isLikelyImpl(this->countPerSimulator().getCount(CSimulatorInfo::xplane()), this->size());
}
int CAircraftModelList::setModelMode(CAircraftModel::ModelMode mode)
{
int c = 0;