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:
Roland Winklmeier
2017-01-07 21:06:56 +01:00
committed by Mathew Sutcliffe
parent 2cea07f174
commit 1a6c7fa192
18 changed files with 135 additions and 84 deletions

View File

@@ -194,6 +194,17 @@ namespace BlackCore
}
}
void CSimulatorCommon::reloadWeatherSettings()
{
if (!m_isWeatherActivated) { return; }
const auto selectedWeatherScenario = m_weatherScenarioSettings.get();
if (!CWeatherScenario::isRealWeatherScenario(selectedWeatherScenario))
{
m_lastWeatherPosition = {};
injectWeatherGrid(CWeatherGrid::getByScenario(selectedWeatherScenario));
}
}
void CSimulatorCommon::reverseLookupAndUpdateOwnAircraftModel(const QString &modelString)
{
CAircraftModel model = getOwnAircraftModel();
@@ -246,6 +257,20 @@ namespace BlackCore
return airports.findClosest(maxAirportsInRange(), ownPosition);
}
void CSimulatorCommon::setWeatherActivated(bool activated)
{
m_isWeatherActivated = activated;
if (m_isWeatherActivated)
{
const auto selectedWeatherScenario = m_weatherScenarioSettings.get();
if (!CWeatherScenario::isRealWeatherScenario(selectedWeatherScenario))
{
m_lastWeatherPosition = {};
injectWeatherGrid(CWeatherGrid::getByScenario(selectedWeatherScenario));
}
}
}
CAircraftModel CSimulatorCommon::reverseLookupModel(const CAircraftModel &model)
{
bool modified = false;