mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 19:35:32 +08:00
Ref T232, some (dispatch) timer code was duplicated
* fixed a bug, where a non existing timer was killed * unified code in base class
This commit is contained in:
@@ -85,7 +85,10 @@ namespace BlackCore
|
||||
CLogMessage(this).info("Initialized simulator driver: '%1'") << m_simulatorPluginInfo.toQString();
|
||||
}
|
||||
|
||||
CSimulatorCommon::~CSimulatorCommon() { }
|
||||
CSimulatorCommon::~CSimulatorCommon()
|
||||
{
|
||||
this->safeKillTimer();
|
||||
}
|
||||
|
||||
const CLogCategoryList &CSimulatorCommon::getLogCategories()
|
||||
{
|
||||
@@ -500,6 +503,13 @@ namespace BlackCore
|
||||
this->blinkHighlightedAircraft();
|
||||
}
|
||||
|
||||
void CSimulatorCommon::safeKillTimer()
|
||||
{
|
||||
if (m_timerId < 0) { return; }
|
||||
this->killTimer(m_timerId);
|
||||
m_timerId = -1;
|
||||
}
|
||||
|
||||
void CSimulatorCommon::onRecalculatedRenderedAircraft(const CAirspaceAircraftSnapshot &snapshot)
|
||||
{
|
||||
if (!snapshot.isValidSnapshot()) { return;}
|
||||
|
||||
@@ -206,8 +206,12 @@ namespace BlackCore
|
||||
//! Slow timer used to highlight aircraft, can be used for other things too
|
||||
virtual void oneSecondTimerTimeout();
|
||||
|
||||
//! Kill timer if id is valid
|
||||
void safeKillTimer();
|
||||
|
||||
bool m_pausedSimFreezesInterpolation = false; //!< paused simulator will also pause interpolation (so AI aircraft will hold)
|
||||
bool m_autoCalcAirportDistance = true; //!< automatically calculate airport distance and bearing
|
||||
int m_timerId = -1; //!< dispatch timer id
|
||||
int m_statsUpdateAircraftCountMs = 0; //!< statistics update count
|
||||
qint64 m_statsUpdateAircraftTimeTotalMs = 0; //!< statistics update time
|
||||
qint64 m_statsUpdateAircraftTimeAvgMs = 0; //!< statistics update time
|
||||
|
||||
Reference in New Issue
Block a user