[XPlane] Avoid elevation requests and minor style fixes in XPlane driver

This commit is contained in:
Klaus Basan
2020-03-20 22:53:35 +01:00
committed by Mat Sutcliffe
parent 651e6bdacf
commit 4d75c1576e
2 changed files with 12 additions and 7 deletions

View File

@@ -193,6 +193,10 @@ namespace BlackSimPlugin
if (this->isShuttingDownOrDisconnected()) { return false; } if (this->isShuttingDownOrDisconnected()) { return false; }
if (reference.isNull()) { return false; } if (reference.isNull()) { return false; }
// avoid requests for NON exising aircraft (based on LINUX crashes)
if (callsign.isEmpty()) { return false; }
if (!this->isAircraftInRange(callsign)) { return false; }
CCoordinateGeodetic pos(reference); CCoordinateGeodetic pos(reference);
if (!pos.hasMSLGeodeticHeight()) if (!pos.hasMSLGeodeticHeight())
{ {
@@ -304,7 +308,7 @@ namespace BlackSimPlugin
{ {
m_lastWeatherPosition = currentPosition; m_lastWeatherPosition = currentPosition;
const auto weatherGrid = CWeatherGrid { { "GLOB", currentPosition } }; const auto weatherGrid = CWeatherGrid { { "GLOB", currentPosition } };
requestWeatherGrid(weatherGrid, { this, &CSimulatorXPlane::injectWeatherGrid }); this->requestWeatherGrid(weatherGrid, { this, &CSimulatorXPlane::injectWeatherGrid });
} }
} }
} // weather } // weather
@@ -327,7 +331,7 @@ namespace BlackSimPlugin
{ {
// Engine number start counting at 1 // Engine number start counting at 1
// We consider the engine running when N1 is bigger than 5 % // We consider the engine running when N1 is bigger than 5 %
CAircraftEngine engine {engineNumber + 1, m_xplaneData.enginesN1Percentage.at(engineNumber) > 5.0}; const CAircraftEngine engine {engineNumber + 1, m_xplaneData.enginesN1Percentage.at(engineNumber) > 5.0};
engines.push_back(engine); engines.push_back(engine);
} }

View File

@@ -251,10 +251,11 @@ namespace BlackSimPlugin
unsigned int m_slowTimerCalls = 0; //!< how often called unsigned int m_slowTimerCalls = 0; //!< how often called
BlackMisc::Aviation::CAirportList m_airportsInRange; //!< aiports in range of own aircraft BlackMisc::Aviation::CAirportList m_airportsInRange; //!< aiports in range of own aircraft
CXPlaneMPAircraftObjects m_xplaneAircraftObjects; //!< XPlane multiplayer aircraft
BlackMisc::Simulation::CSimulatedAircraftList m_pendingToBeAddedAircraft; //!< aircraft to be added BlackMisc::Simulation::CSimulatedAircraftList m_pendingToBeAddedAircraft; //!< aircraft to be added
QHash<BlackMisc::Aviation::CCallsign, qint64> m_addingInProgressAircraft; //!< aircraft just adding QHash<BlackMisc::Aviation::CCallsign, qint64> m_addingInProgressAircraft; //!< aircraft just adding
BlackMisc::Simulation::CSimulatedAircraftList m_aircraftAddedFailed; //! aircraft for which adding failed BlackMisc::Simulation::CSimulatedAircraftList m_aircraftAddedFailed; //!< aircraft for which adding failed
CXPlaneMPAircraftObjects m_xplaneAircraftObjects; //!< XPlane multiplayer aircraft
XPlaneData m_xplaneData; //!< XPlane data XPlaneData m_xplaneData; //!< XPlane data
// statistics // statistics