diff --git a/src/blackcore/airspacemonitor.cpp b/src/blackcore/airspacemonitor.cpp index 7fa90b5ad..4cbe67bc7 100644 --- a/src/blackcore/airspacemonitor.cpp +++ b/src/blackcore/airspacemonitor.cpp @@ -549,7 +549,6 @@ namespace BlackCore m_flightPlanCache.clear(); m_readiness.clear(); m_queryPilot.clear(); - m_fullSituations.clear(); } void CAirspaceMonitor::removeFromAircraftCachesAndLogs(const CCallsign &callsign) @@ -557,7 +556,6 @@ namespace BlackCore if (callsign.isEmpty()) { return; } m_flightPlanCache.remove(callsign); m_readiness.remove(callsign); - m_fullSituations.remove(callsign); this->removeReverseLookupMessages(callsign); } @@ -1272,16 +1270,11 @@ namespace BlackCore // update client info this->autoAdjustCientGndCapability(situation); - Q_ASSERT_X(!situation.hasVelocity(), Q_FUNC_INFO, "Velocity of aircraft updates must be invalid"); + Q_ASSERT_X(!situation.hasVelocity(), Q_FUNC_INFO, "Velocity of full aircraft updates must be invalid"); // store situation history this->storeAircraftSituation(situation); // updates situation - // The packet is only stored above, if previously no velocity packet was added. - // To transfer data from the @ update to velocity updates, store this situation separatly - // TODO: Not needed anymore if all packets would be added to the history - m_fullSituations[callsign] = situation; - // in case we only have if (!existsInRange && validMaxRange) { @@ -1381,28 +1374,9 @@ namespace BlackCore // hence set the last known value from last full update or last visual update. // If there is no full position available yet, throw this visual position away. CAircraftSituation visualSituation(situation); - CAircraftSituation lastSituation{}; - auto lastDataIt = m_fullSituations.find(callsign); CAircraftSituationList history = this->remoteAircraftSituations(callsign); - if (lastDataIt != m_fullSituations.end()) - { - // New full update in last data. - lastSituation = *lastDataIt; - m_fullSituations.erase(lastDataIt); - } - else if (!history.empty()) - { - // Use full update info from last position/visual update - lastSituation = history.latestObject(); - } - else - { - // No full update received yet. Should never happen because the aircraft must be in range (PilotUpdate received) - // before even getting here. - Q_ASSERT_X(false, Q_FUNC_INFO, "No information about this aircraft yet"); - // Throw away visual update - return; - } + if (history.empty()) { return; } // we need one full situation at least + const CAircraftSituation lastSituation = history.latestObject(); // changed position, continue and copy values visualSituation.setCurrentUtcTime(); diff --git a/src/blackcore/airspacemonitor.h b/src/blackcore/airspacemonitor.h index 4000c4050..239bcc71d 100644 --- a/src/blackcore/airspacemonitor.h +++ b/src/blackcore/airspacemonitor.h @@ -289,7 +289,6 @@ namespace BlackCore BlackMisc::CSettingReadOnly m_matchingSettings { this }; //!< settings QQueue m_queryAtis; //!< query the ATIS QQueue m_queryPilot; //!< query the pilot data - QMap m_fullSituations; //!< last reported full position Fsd::CFSDClient *m_fsdClient = nullptr; //!< corresponding network interface CAirspaceAnalyzer *m_analyzer = nullptr; //!< owned analyzer bool m_bookingsRequested = false; //!< bookings have been requested, it can happen we receive an BlackCore::Vatsim::CVatsimBookingReader::atcBookingsReadUnchanged signal diff --git a/src/blackmisc/simulation/interpolatorvelocity.cpp b/src/blackmisc/simulation/interpolatorvelocity.cpp index b9f03632a..eb4847e27 100644 --- a/src/blackmisc/simulation/interpolatorvelocity.cpp +++ b/src/blackmisc/simulation/interpolatorvelocity.cpp @@ -86,6 +86,12 @@ namespace BlackMisc::Simulation m_pitchDelta = correctTurnDirection(m_pitchDelta); } + void CInterpolatorVelocity::CInterpolant::update(qint64 currentMsSinceEpoch) + { + Q_ASSERT_X(currentMsSinceEpoch >= m_creationTimeMsSinceEpoch, Q_FUNC_INFO, "Updated current time must be greater creation time"); + m_currentTimeMsSinceEpoch = currentMsSinceEpoch; + } + void CInterpolatorVelocity::anchor() { } diff --git a/src/blackmisc/simulation/interpolatorvelocity.h b/src/blackmisc/simulation/interpolatorvelocity.h index 4df7195fd..5a8e19183 100644 --- a/src/blackmisc/simulation/interpolatorvelocity.h +++ b/src/blackmisc/simulation/interpolatorvelocity.h @@ -58,7 +58,7 @@ namespace BlackMisc //! Update interpolant to given timestamp. Every following call to //! interpolatePositionAndAltitude(..) will return the situation according to this timestamp. - void update(qint64 currentMsSinceEpoch) { m_currentTimeMsSinceEpoch = currentMsSinceEpoch; } + void update(qint64 currentMsSinceEpoch); private: Aviation::CAircraftSituation m_currentSitutation; diff --git a/src/blackmisc/simulation/remoteaircraftprovider.cpp b/src/blackmisc/simulation/remoteaircraftprovider.cpp index 802619122..90d70f1e4 100644 --- a/src/blackmisc/simulation/remoteaircraftprovider.cpp +++ b/src/blackmisc/simulation/remoteaircraftprovider.cpp @@ -289,14 +289,10 @@ namespace BlackMisc::Simulation { newSituationsList.prefillLatestAdjustedFirst(situationCorrected, IRemoteAircraftProvider::MaxSituationsPerCallsign); } - else if (!situationCorrected.hasVelocity() && newSituationsList.front().hasVelocity()) - { - return situationCorrected; - } else { - // newSituationsList.push_frontKeepLatestFirstIgnoreOverlapping(situationCorrected, true, IRemoteAircraftProvider::MaxSituationsPerCallsign); - newSituationsList.push_frontKeepLatestFirstAdjustOffset(situationCorrected, true, IRemoteAircraftProvider::MaxSituationsPerCallsign); + newSituationsList.push_frontKeepLatestFirstIgnoreOverlapping(situationCorrected, true, IRemoteAircraftProvider::MaxSituationsPerCallsign); + // newSituationsList.push_frontKeepLatestFirstAdjustOffset(situationCorrected, true, IRemoteAircraftProvider::MaxSituationsPerCallsign); newSituationsList.setAdjustedSortHint(CAircraftSituationList::AdjustedTimestampLatestFirst); newSituationsList.transferElevationForward(); // transfer elevations, will do nothing if elevations already exist