From 51ad9842003f3e9104521e4666cd14c8dd257f82 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Mon, 9 Jul 2018 22:18:57 +0200 Subject: [PATCH] Ref T268, consider "blinking" in simulator common --- src/blackcore/simulatorcommon.cpp | 25 +++++++++++++++++-------- src/blackcore/simulatorcommon.h | 5 ++++- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/blackcore/simulatorcommon.cpp b/src/blackcore/simulatorcommon.cpp index a5616ebce..f28a58848 100644 --- a/src/blackcore/simulatorcommon.cpp +++ b/src/blackcore/simulatorcommon.cpp @@ -147,7 +147,7 @@ namespace BlackCore // blink mode, toggle aircraft for (const CSimulatedAircraft &aircraft : as_const(m_highlightedAircraft)) { - if (m_blinkCycle) { this->callPhysicallyRemoveRemoteAircraft(aircraft.getCallsign()); } + if (m_blinkCycle) { this->callPhysicallyRemoveRemoteAircraft(aircraft.getCallsign(), true); } else { this->callPhysicallyAddRemoteAircraft(aircraft); } } } @@ -170,6 +170,17 @@ namespace BlackCore } } + void CSimulatorCommon::clearData(const CCallsign &callsign) + { + m_highlightedAircraft.removeByCallsign(callsign); + m_statsPhysicallyRemovedAircraft++; + m_clampedLogMsg.clear(); + m_lastSentParts.remove(callsign); + m_lastSentSituations.remove(callsign); + m_clampedLogMsg.remove(callsign); + this->removeInterpolationSetupPerCallsign(callsign); + } + void CSimulatorCommon::reloadWeatherSettings() { if (!m_isWeatherActivated) { return; } @@ -649,6 +660,7 @@ namespace BlackCore m_statsLastUpdateAircraftRequestedMs = 0; m_statsUpdateAircraftRequestedDeltaMs = 0; m_statsUpdateAircraftLimited = 0; + ISimulationEnvironmentProvider::resetSimulationEnvironmentStatistics(); } CStatusMessageList CSimulatorCommon::debugVerifyStateAfterAllAircraftRemoved() const @@ -719,7 +731,7 @@ namespace BlackCore Q_ASSERT_X(compare.hasCallsign(), Q_FUNC_INFO, "Need callsign"); if (!m_lastSentSituations.contains(compare.getCallsign())) { return false; } if (compare.isNull()) { return false; } - return compare.equalPbhAndVector(m_lastSentSituations.value(compare.getCallsign())); + return compare.equalPbhVectorAltitude(m_lastSentSituations.value(compare.getCallsign())); } bool CSimulatorCommon::isEqualLastSent(const CAircraftParts &compare, const CCallsign &callsign) const @@ -838,6 +850,7 @@ namespace BlackCore m_lastSentSituations.clear(); m_updateRemoteAircraftInProgress = false; + this->clearInterpolationSetupsPerCallsign(); this->resetHighlighting(); this->resetAircraftStatistics(); } @@ -875,13 +888,9 @@ namespace BlackCore this->physicallyAddRemoteAircraft(remoteAircraft); } - void CSimulatorCommon::callPhysicallyRemoveRemoteAircraft(const CCallsign &remoteCallsign) + void CSimulatorCommon::callPhysicallyRemoveRemoteAircraft(const CCallsign &remoteCallsign, bool blinking) { - m_statsPhysicallyRemovedAircraft++; - m_clampedLogMsg.clear(); - m_lastSentParts.remove(remoteCallsign); - m_lastSentSituations.remove(remoteCallsign); - m_clampedLogMsg.remove(remoteCallsign); + if (!blinking) { this->clearData(remoteCallsign); } this->physicallyRemoveRemoteAircraft(remoteCallsign); } diff --git a/src/blackcore/simulatorcommon.h b/src/blackcore/simulatorcommon.h index 20b4bbc09..f87615260 100644 --- a/src/blackcore/simulatorcommon.h +++ b/src/blackcore/simulatorcommon.h @@ -203,6 +203,9 @@ namespace BlackCore //! Restore aircraft from the provider data void resetAircraftFromProvider(const BlackMisc::Aviation::CCallsign &callsign); + //! Clear the related data as statistics etc. + virtual void clearData(const BlackMisc::Aviation::CCallsign &callsign); + //! Set own model void reverseLookupAndUpdateOwnAircraftModel(const BlackMisc::Simulation::CAircraftModel &model); @@ -313,7 +316,7 @@ namespace BlackCore // call with counters updated void callPhysicallyAddRemoteAircraft(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft); - void callPhysicallyRemoveRemoteAircraft(const BlackMisc::Aviation::CCallsign &remoteCallsign); + void callPhysicallyRemoveRemoteAircraft(const BlackMisc::Aviation::CCallsign &remoteCallsign, bool blinking = false); //! Display a logged situation in simulator void displayLoggedSituationInSimulator(const BlackMisc::Aviation::CCallsign &cs, bool stopLogging, int times = 40);