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;

View File

@@ -229,9 +229,18 @@ namespace BlackMisc
//! Set simulator for all elements
int setSimulatorInfo(const CSimulatorInfo &info);
//! Which simulators are supported in that model list
//! Which simulators are supported in this model list
CSimulatorInfo simulatorsSupported() const;
//! Is this here a FS family (P3D/FSX/FS9) model list?
bool isLikelyFsFamilyModelList() const;
//! Is this here a FS family (P3D/FSX) model list?
bool isLikelyFsxFamilyModelList() const;
//! Is this here a XPlane model list?
bool isLikelyXplaneModelList() const;
//! Set mode for all elements
int setModelMode(CAircraftModel::ModelMode mode);