mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 23:25:53 +08:00
@@ -113,6 +113,7 @@ namespace BlackSimPlugin
|
||||
"B737-400 default model",
|
||||
CAircraftIcaoCode("B734", "L2J")
|
||||
));
|
||||
ps_reloadSettings();
|
||||
}
|
||||
|
||||
bool CSimulatorFs9::isConnected() const
|
||||
@@ -332,7 +333,8 @@ namespace BlackSimPlugin
|
||||
updateOwnSituation(aircraftSituation);
|
||||
|
||||
const auto currentPosition = CCoordinateGeodetic { aircraftSituation.latitude(), aircraftSituation.longitude(), {0} };
|
||||
if (calculateGreatCircleDistance(m_lastWeatherPosition, currentPosition).value(CLengthUnit::mi()) > 20 )
|
||||
if (CWeatherScenario::isRealWeatherScenario(m_weatherScenarioSettings.get()) &&
|
||||
calculateGreatCircleDistance(m_lastWeatherPosition, currentPosition).value(CLengthUnit::mi()) > 20 )
|
||||
{
|
||||
m_lastWeatherPosition = currentPosition;
|
||||
const auto weatherGrid = CWeatherGrid { { "GLOB", currentPosition } };
|
||||
@@ -353,6 +355,16 @@ namespace BlackSimPlugin
|
||||
}
|
||||
}
|
||||
|
||||
void CSimulatorFs9::ps_reloadSettings()
|
||||
{
|
||||
auto selectedWeatherScenario = m_weatherScenarioSettings.get();
|
||||
if (CWeatherScenario::isRealWeatherScenario(selectedWeatherScenario))
|
||||
{
|
||||
m_lastWeatherPosition = {};
|
||||
injectWeatherGrid(CWeatherGrid::getByScenario(selectedWeatherScenario));
|
||||
}
|
||||
}
|
||||
|
||||
void CSimulatorFs9::updateOwnAircraftFromSimulator(const CSimulatedAircraft &simDataOwnAircraft)
|
||||
{
|
||||
this->updateCockpit(
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "fs9client.h"
|
||||
#include "lobbyclient.h"
|
||||
#include "../fscommon/simulatorfscommon.h"
|
||||
#include "blackcore/settings/simulator.h"
|
||||
#include "blackcore/simulator.h"
|
||||
#include "blackmisc/interpolator.h"
|
||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||
@@ -98,6 +99,9 @@ namespace BlackSimPlugin
|
||||
//! Process incoming FS9 message
|
||||
void ps_processFs9Message(const QByteArray &message);
|
||||
|
||||
//! Reload settings
|
||||
void ps_reloadSettings();
|
||||
|
||||
private:
|
||||
|
||||
//! Called when data about our own aircraft are received
|
||||
@@ -116,6 +120,7 @@ namespace BlackSimPlugin
|
||||
QSharedPointer<CLobbyClient> m_lobbyClient;
|
||||
|
||||
BlackMisc::Geo::CCoordinateGeodetic m_lastWeatherPosition; //!< Own aircraft position at which weather was fetched and injected last
|
||||
BlackMisc::CSetting<BlackCore::Settings::Simulator::SelectedWeatherScenario> m_weatherScenarioSettings { this, &CSimulatorFs9::ps_reloadSettings };
|
||||
};
|
||||
|
||||
//! Listener for FS9
|
||||
|
||||
Reference in New Issue
Block a user