diff --git a/src/blackcore/context/contextsimulatorimpl.cpp b/src/blackcore/context/contextsimulatorimpl.cpp index 3fe5d237c..a763e5eea 100644 --- a/src/blackcore/context/contextsimulatorimpl.cpp +++ b/src/blackcore/context/contextsimulatorimpl.cpp @@ -526,6 +526,7 @@ namespace BlackCore const CLength cg = m_simulatorPlugin.second->getCGPerModelString(aircraftModel.getModelString()); if (!cg.isNull()) { aircraftModel.setCG(cg); } this->updateAircraftModel(callsign, aircraftModel, this->identifier()); + const CSimulatedAircraft aircraftAfterModelApplied = this->getAircraftInRangeForCallsign(remoteAircraft.getCallsign()); if (!aircraftAfterModelApplied.hasModelString()) { @@ -539,12 +540,16 @@ namespace BlackCore brokenAircraft.setEnabled(false); brokenAircraft.setRendered(false); emit this->aircraftRenderingChanged(brokenAircraft); - CMatchingUtils::addLogDetailsToList(pMatchingMessages, callsign, QString("Cannot add remote aircraft, no model string: %1").arg(brokenAircraft.toQString())); + CMatchingUtils::addLogDetailsToList(pMatchingMessages, callsign, QString("Cannot add remote aircraft, no model string: '%1'").arg(brokenAircraft.toQString())); return; } m_simulatorPlugin.second->logicallyAddRemoteAircraft(aircraftAfterModelApplied); CMatchingUtils::addLogDetailsToList(pMatchingMessages, callsign, QString("Logically added remote aircraft: %1").arg(aircraftAfterModelApplied.toQString())); + + this->clearMatchingMessages(callsign); this->addMatchingMessages(callsign, matchingMessages); + + // done emit this->modelMatchingCompleted(aircraftAfterModelApplied); } @@ -915,6 +920,12 @@ namespace BlackCore } } + void CContextSimulator::clearMatchingMessages(const CCallsign &callsign) + { + if (callsign.isEmpty()) { return; } + m_matchingMessages.remove(callsign); + } + void CContextSimulator::initByLastUsedModelSet() { // no models in matcher, but in cache, we can set them as default diff --git a/src/blackcore/context/contextsimulatorimpl.h b/src/blackcore/context/contextsimulatorimpl.h index e01b997c6..ea866def5 100644 --- a/src/blackcore/context/contextsimulatorimpl.h +++ b/src/blackcore/context/contextsimulatorimpl.h @@ -229,14 +229,17 @@ namespace BlackCore //! Add to message list for matching void addMatchingMessages(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::CStatusMessageList &messages); + //! Clear matching messages + void clearMatchingMessages(const BlackMisc::Aviation::CCallsign &callsign); + //! Load the last know model set void initByLastUsedModelSet(); QPair> m_simulatorPlugin; //!< Currently loaded simulator plugin - CPluginManagerSimulator *m_plugins = nullptr; //!< plugin manager - BlackMisc::CRegularThread m_listenersThread; //!< waiting for plugin - CWeatherManager m_weatherManager { this }; //!< weather management - CAircraftMatcher m_aircraftMatcher { this }; //!< model matcher + CPluginManagerSimulator *m_plugins = nullptr; //!< plugin manager + BlackMisc::CRegularThread m_listenersThread; //!< waiting for plugin + CWeatherManager m_weatherManager { this }; //!< weather management + CAircraftMatcher m_aircraftMatcher { this }; //!< model matcher QMap m_matchingMessages; //!< all matching log messages per callsign BlackMisc::CSetting m_matchingSettings { this }; //!< settings