From f053ead918b434613a9e70f374125834cba99440 Mon Sep 17 00:00:00 2001 From: Sven Czarnian Date: Thu, 9 Dec 2021 12:29:38 +0100 Subject: [PATCH] send the new sequence after every update --- src/PlugIn.cpp | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/PlugIn.cpp b/src/PlugIn.cpp index 3fa825e..3d220b1 100644 --- a/src/PlugIn.cpp +++ b/src/PlugIn.cpp @@ -680,25 +680,23 @@ void PlugIn::OnTimer(int counter) { for (auto& airport : this->m_updateQueue) { aman::AircraftUpdate update; update.set_airport(airport.first); - bool inserted = false; - for (auto target = this->RadarTargetSelectFirst(); true == target.IsValid(); target = this->RadarTargetSelectNext(target)) { - auto it = std::find(airport.second.begin(), airport.second.end(), target.GetCallsign()); - if (airport.second.end() != it) { - auto report = update.add_reports(); - this->generateAircraftReportMessage(target, report); - inserted = true; + if (0 != airport.second.size()) { + for (auto target = this->RadarTargetSelectFirst(); true == target.IsValid(); target = this->RadarTargetSelectNext(target)) { + auto it = std::find(airport.second.begin(), airport.second.end(), target.GetCallsign()); + if (airport.second.end() != it) { + auto report = update.add_reports(); + this->generateAircraftReportMessage(target, report); + } } } - if (true == inserted) { - /* send the report and request the current sequence */ - auto sequence = Backend::instance().update(update); - if (nullptr == sequence) - this->DisplayUserMessage(PLUGIN_NAME, "ERROR", "Unable to send a new aircraft report update", true, true, true, true, true); - else - this->updateSequence(sequence); - } + /* send the report and request the current sequence */ + auto sequence = Backend::instance().update(update); + if (nullptr == sequence) + this->DisplayUserMessage(PLUGIN_NAME, "ERROR", "Unable to send a new aircraft report update", true, true, true, true, true); + else + this->updateSequence(sequence); airport.second.clear(); }