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:
Roland Winklmeier
2018-02-03 16:02:24 +01:00
committed by Klaus Basan
parent 1b5a0a7f4d
commit 597f3f7a6a

View File

@@ -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);
}