[Weather] Only send weather if activated

This commit is contained in:
Klaus Basan
2020-04-29 22:32:08 +02:00
committed by Mat Sutcliffe
parent bba07ef4c4
commit 1fb97755ce
2 changed files with 10 additions and 4 deletions

View File

@@ -883,10 +883,15 @@ namespace BlackCore
void CContextSimulator::onWeatherGridReceived(const CWeatherGrid &weatherGrid, const CIdentifier &identifier)
{
if (!this->isSimulatorPluginAvailable()) { return; }
if (!m_simulatorPlugin.second) { return; }
if (m_simulatorPlugin.second->identifier() == identifier)
if (!m_simulatorPlugin.second) { return; }
if (m_simulatorPlugin.second && m_simulatorPlugin.second->identifier() == identifier)
{
m_simulatorPlugin.second->injectWeatherGrid(weatherGrid);
// ONLY send if WEATHER is ON
if (m_simulatorPlugin.second->isWeatherActivated())
{
m_simulatorPlugin.second->injectWeatherGrid(weatherGrid);
}
}
}

View File

@@ -898,7 +898,8 @@ namespace BlackSimPlugin
void CSimulatorXPlane::injectWeatherGrid(const CWeatherGrid &weatherGrid)
{
if (this->isShuttingDownOrDisconnected()) { return; }
if (weatherGrid.isEmpty()) { return; }
if (weatherGrid.isEmpty()) { return; }
if (!this->isWeatherActivated()) { return; }
if (!CThreadUtils::isCurrentThreadObjectThread(this))
{