mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
Ref T259, Ref T243 situation/parts/lights adjustments
* guessing now in parts/lights (so it can be used with all sims) * minor renamings * init FSX data definitions from parts
This commit is contained in:
@@ -7,14 +7,16 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackmisc/aviation/aircraftparts.h"
|
||||
#include "aircraftparts.h"
|
||||
#include "aircraftlights.h"
|
||||
#include "aircraftsituation.h"
|
||||
#include "blackmisc/comparefunctions.h"
|
||||
#include "blackmisc/stringutils.h"
|
||||
|
||||
#include "QStringBuilder"
|
||||
#include <QtGlobal>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -39,6 +41,45 @@ namespace BlackMisc
|
||||
return json;
|
||||
}
|
||||
|
||||
CAircraftParts CAircraftParts::guessedParts(const CAircraftSituation &situation, bool vtol, int engineNumber)
|
||||
{
|
||||
CAircraftParts parts;
|
||||
CAircraftEngineList engines;
|
||||
parts.setLights(CAircraftLights::guessedLights(situation));
|
||||
|
||||
const bool onGround = situation.isOnGround();
|
||||
if (onGround)
|
||||
{
|
||||
parts.setGearDown(true);
|
||||
engines.initEngines(engineNumber, situation.isMoving());
|
||||
}
|
||||
else
|
||||
{
|
||||
parts.setGearDown(false);
|
||||
engines.initEngines(engineNumber, true);
|
||||
if (vtol)
|
||||
{
|
||||
|
||||
}
|
||||
else if (situation.hasGroundElevation())
|
||||
{
|
||||
const double aGroundFt = situation.getHeightAboveGround().value(CLengthUnit::ft());
|
||||
if (aGroundFt < 1000)
|
||||
{
|
||||
parts.setGearDown(true);
|
||||
parts.setFlapsPercent(25);
|
||||
}
|
||||
else if (aGroundFt < 2000)
|
||||
{
|
||||
parts.setGearDown(true);
|
||||
parts.setFlapsPercent(10);
|
||||
}
|
||||
}
|
||||
}
|
||||
parts.setEngines(engines);
|
||||
return parts;
|
||||
}
|
||||
|
||||
CVariant CAircraftParts::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
@@ -92,6 +133,15 @@ namespace BlackMisc
|
||||
return 0;
|
||||
}
|
||||
|
||||
CAircraftLights CAircraftParts::getAdjustedLights() const
|
||||
{
|
||||
CAircraftLights lights = this->getLights();
|
||||
const bool anyEngine = this->isAnyEngineOn();
|
||||
lights.setRecognitionOn(anyEngine);
|
||||
lights.setCabinOn(anyEngine);
|
||||
return lights;
|
||||
}
|
||||
|
||||
void CAircraftParts::setAllLightsOn()
|
||||
{
|
||||
m_lights.setAllOn();
|
||||
@@ -117,6 +167,11 @@ namespace BlackMisc
|
||||
return m_engines.isAnyEngineOn();
|
||||
}
|
||||
|
||||
void CAircraftParts::guessParts(const CAircraftSituation &situation)
|
||||
{
|
||||
*this = guessedParts(situation);
|
||||
}
|
||||
|
||||
double CAircraftParts::isOnGroundInterpolated() const
|
||||
{
|
||||
if (m_isOnGroundInterpolated < 0)
|
||||
|
||||
Reference in New Issue
Block a user