From 5b171e7b9409f5ada6877282460347013482202d Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Fri, 15 Jun 2018 12:37:39 +0200 Subject: [PATCH] Ref T280, fixed usage for aircraft change * calculate only simple changes (without deviations) if those are not needed * return "change" object so it can be re-used --- src/blackmisc/aviation/aircraftsituationlist.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/blackmisc/aviation/aircraftsituationlist.cpp b/src/blackmisc/aviation/aircraftsituationlist.cpp index 013273ca0..ab3226996 100644 --- a/src/blackmisc/aviation/aircraftsituationlist.cpp +++ b/src/blackmisc/aviation/aircraftsituationlist.cpp @@ -57,8 +57,7 @@ namespace BlackMisc if (this->isEmpty()) { return 0; } Q_ASSERT_X(m_tsAdjustedSortHint == CAircraftSituationList::AdjustedTimestampLatestFirst || this->isSortedAdjustedLatestFirstWithoutNullPositions(), Q_FUNC_INFO, "Need sorted situations without NULL positions"); - const CAircraftSituationChange change(*this, model.getCG(), model.isVtol(), true, true); - if (changeOut) { *changeOut = change; } // copy over + const CAircraftSituationChange simpleChange(*this, model.getCG(), model.isVtol(), true, false); int c = 0; bool latest = true; @@ -69,11 +68,18 @@ namespace BlackMisc { // change is only valid for the latest situation // this will do nothing if not appropriate - s.guessOnGround(latest ? change : CAircraftSituationChange::null(), model); + s.guessOnGround(latest ? simpleChange : CAircraftSituationChange::null(), model); c++; } latest = false; } + + if (changeOut) + { + const CAircraftSituationChange change(*this, model.getCG(), model.isVtol(), true, true); + *changeOut = change; + } + return c; }