mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 15:45:46 +08:00
Add basic weather handling to emulated simulator
It won't do much apart from requesting a weather grid. It might be useful in the future to debug the weather engine. But for now it helps to detect issues in the request path. ref T235
This commit is contained in:
committed by
Klaus Basan
parent
1b5a0a7f4d
commit
597f3f7a6a
@@ -220,6 +220,19 @@ namespace BlackSimPlugin
|
||||
{
|
||||
if (m_myAircraft.getSituation() == situation) { return false; }
|
||||
m_myAircraft.setSituation(situation);
|
||||
|
||||
if (m_isWeatherActivated)
|
||||
{
|
||||
const auto currentPosition = CCoordinateGeodetic { situation.latitude(), situation.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, &CSimulatorEmulated::injectWeatherGrid });
|
||||
}
|
||||
}
|
||||
|
||||
return this->updateOwnSituation(situation);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user