mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 13:36:48 +08:00
Add control button to activate and deactivate swift weather
- GUI changes - Context and ISimulator APIs - Refactored settings and static weather injection in CSimulatorCommon refs #807
This commit is contained in:
committed by
Mathew Sutcliffe
parent
2cea07f174
commit
1a6c7fa192
@@ -139,7 +139,6 @@ namespace BlackSimPlugin
|
||||
{
|
||||
m_fsuipc->connect(); // connect FSUIPC too
|
||||
}
|
||||
reloadWeatherSettings();
|
||||
initInternalsObject();
|
||||
m_dispatchTimerId = startTimer(50);
|
||||
return true;
|
||||
@@ -340,15 +339,17 @@ namespace BlackSimPlugin
|
||||
auto aircraftSituation = aircraftSituationfromFS9(mpPositionVelocity);
|
||||
updateOwnSituation(aircraftSituation);
|
||||
|
||||
const auto currentPosition = CCoordinateGeodetic { aircraftSituation.latitude(), aircraftSituation.longitude(), {0} };
|
||||
if (CWeatherScenario::isRealWeatherScenario(m_weatherScenarioSettings.get()) &&
|
||||
calculateGreatCircleDistance(m_lastWeatherPosition, currentPosition).value(CLengthUnit::mi()) > 20)
|
||||
if (m_isWeatherActivated)
|
||||
{
|
||||
m_lastWeatherPosition = currentPosition;
|
||||
const auto weatherGrid = CWeatherGrid { { "GLOB", currentPosition } };
|
||||
requestWeatherGrid(weatherGrid, { this, &CSimulatorFs9::injectWeatherGrid });
|
||||
const auto currentPosition = CCoordinateGeodetic { aircraftSituation.latitude(), aircraftSituation.longitude(), {0} };
|
||||
if (CWeatherScenario::isRealWeatherScenario(m_weatherScenarioSettings.get()) &&
|
||||
calculateGreatCircleDistance(m_lastWeatherPosition, currentPosition).value(CLengthUnit::mi()) > 20)
|
||||
{
|
||||
m_lastWeatherPosition = currentPosition;
|
||||
const auto weatherGrid = CWeatherGrid { { "GLOB", currentPosition } };
|
||||
requestWeatherGrid(weatherGrid, { this, &CSimulatorFs9::injectWeatherGrid });
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case CFs9Sdk::MPCHAT_PACKET_ID_CHAT_TEXT_SEND:
|
||||
@@ -390,18 +391,6 @@ namespace BlackSimPlugin
|
||||
m_fsuipc->write(weatherGrid);
|
||||
}
|
||||
|
||||
void CSimulatorFs9::reloadWeatherSettings()
|
||||
{
|
||||
if (!m_useFsuipc || !m_fsuipc) { return; }
|
||||
if (!m_fsuipc->isConnected()) { return; }
|
||||
const auto selectedWeatherScenario = m_weatherScenarioSettings.get();
|
||||
if (!CWeatherScenario::isRealWeatherScenario(selectedWeatherScenario))
|
||||
{
|
||||
m_lastWeatherPosition = {};
|
||||
injectWeatherGrid(CWeatherGrid::getByScenario(selectedWeatherScenario));
|
||||
}
|
||||
}
|
||||
|
||||
CSimulatorFs9Listener::CSimulatorFs9Listener(const CSimulatorPluginInfo &info,
|
||||
const QSharedPointer<CFs9Host> &fs9Host,
|
||||
const QSharedPointer<CLobbyClient> &lobbyClient) :
|
||||
|
||||
Reference in New Issue
Block a user