mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Ref T786, make sure to request weather if scenario/settings have changed and/or weather was activated
This commit is contained in:
committed by
Mat Sutcliffe
parent
9430bb55cb
commit
70766beea8
@@ -142,15 +142,27 @@ namespace BlackCore
|
||||
if (m_isWeatherActivated)
|
||||
{
|
||||
const auto selectedWeatherScenario = m_weatherScenarioSettings.get();
|
||||
if (!CWeatherScenario::isRealWeatherScenario(selectedWeatherScenario))
|
||||
if (CWeatherScenario::isRealWeatherScenario(selectedWeatherScenario))
|
||||
{
|
||||
m_lastWeatherPosition = {};
|
||||
if (m_lastWeatherPosition.isNull())
|
||||
{
|
||||
const CCoordinateGeodetic p = this->getOwnAircraftPosition();
|
||||
if (!p.isNull())
|
||||
{
|
||||
m_lastWeatherPosition = p;
|
||||
this->requestWeatherGrid(p, this->identifier());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_lastWeatherPosition.setNull();
|
||||
this->injectWeatherGrid(CWeatherGrid::getByScenario(selectedWeatherScenario));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_lastWeatherPosition = {}; // clean up so next time we fetch weather again
|
||||
m_lastWeatherPosition.setNull(); // clean up so next time we fetch weather again
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,10 +176,22 @@ namespace BlackCore
|
||||
// log crash info about weather
|
||||
if (sApp && !sApp->isShuttingDown()) { CCrashHandler::instance()->crashAndLogAppendInfo(u"Simulator weather: " % boolToYesNo(m_isWeatherActivated)); }
|
||||
if (!m_isWeatherActivated) { return; }
|
||||
m_lastWeatherPosition.setNull();
|
||||
const CWeatherScenario selectedWeatherScenario = m_weatherScenarioSettings.get();
|
||||
if (!CWeatherScenario::isRealWeatherScenario(selectedWeatherScenario))
|
||||
if (CWeatherScenario::isRealWeatherScenario(selectedWeatherScenario))
|
||||
{
|
||||
if (m_lastWeatherPosition.isNull())
|
||||
{
|
||||
const CCoordinateGeodetic p = this->getOwnAircraftPosition();
|
||||
if (!p.isNull())
|
||||
{
|
||||
m_lastWeatherPosition = p;
|
||||
this->requestWeatherGrid(p, this->identifier());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_lastWeatherPosition = {};
|
||||
this->injectWeatherGrid(CWeatherGrid::getByScenario(selectedWeatherScenario));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user