From 524a9b37933e30966e956d5719ff7b515b981c9a Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Fri, 27 Dec 2019 23:19:09 +0100 Subject: [PATCH] ATC stations, style and minor fixes --- src/blackcore/airspacemonitor.cpp | 14 ++++++++------ src/blackcore/fsd/atcdataupdate.h | 12 ++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/blackcore/airspacemonitor.cpp b/src/blackcore/airspacemonitor.cpp index 50a027381..76e152f2e 100644 --- a/src/blackcore/airspacemonitor.cpp +++ b/src/blackcore/airspacemonitor.cpp @@ -470,13 +470,16 @@ namespace BlackCore void CAirspaceMonitor::onRealNameReplyReceived(const CCallsign &callsign, const QString &realname) { - if (!this->isConnectedAndNotShuttingDown() || realname.isEmpty()) { return; } - int wasAtc = false; + if (!this->isConnectedAndNotShuttingDown() || realname.isEmpty()) { return; } + if (!sApp || sApp->isShuttingDown() || !sApp->getWebDataServices()) { return; } + + bool wasAtc = false; + const QString rn = CUser::beautifyRealName(realname); if (callsign.hasSuffix()) { // very likely and ATC callsign - const CPropertyIndexVariantMap vm = CPropertyIndexVariantMap({ CAtcStation::IndexController, CUser::IndexRealName }, realname); + const CPropertyIndexVariantMap vm = CPropertyIndexVariantMap({ CAtcStation::IndexController, CUser::IndexRealName }, rn); const int c1 = this->updateOnlineStation(callsign, vm, false, true); const int c2 = this->updateBookedStation(callsign, vm, false, true); wasAtc = c1 > 0 || c2 > 0; @@ -484,14 +487,13 @@ namespace BlackCore if (!wasAtc) { - const CPropertyIndexVariantMap vm = CPropertyIndexVariantMap({CSimulatedAircraft::IndexPilot, CUser::IndexRealName}, realname); + const CPropertyIndexVariantMap vm = CPropertyIndexVariantMap({CSimulatedAircraft::IndexPilot, CUser::IndexRealName}, rn); this->updateAircraftInRange(callsign, vm); } // Client - if (!sApp || sApp->isShuttingDown() || !sApp->getWebDataServices()) { return; } const CVoiceCapabilities voiceCaps = sApp->getWebDataServices()->getVoiceCapabilityForCallsign(callsign); - CPropertyIndexVariantMap vm = CPropertyIndexVariantMap({ CClient::IndexUser, CUser::IndexRealName }, realname); + CPropertyIndexVariantMap vm = CPropertyIndexVariantMap({ CClient::IndexUser, CUser::IndexRealName }, rn); vm.addValue({ CClient::IndexVoiceCapabilities }, voiceCaps); this->updateOrAddClient(callsign, vm, false); } diff --git a/src/blackcore/fsd/atcdataupdate.h b/src/blackcore/fsd/atcdataupdate.h index c4d80be0f..7c9d427cd 100644 --- a/src/blackcore/fsd/atcdataupdate.h +++ b/src/blackcore/fsd/atcdataupdate.h @@ -58,15 +58,15 @@ namespace BlackCore //! Equal to operator inline bool operator==(const AtcDataUpdate &lhs, const AtcDataUpdate &rhs) { - return lhs.sender() == rhs.sender() && - lhs.receiver() == rhs.receiver() && + return lhs.sender() == rhs.sender() && + lhs.receiver() == rhs.receiver() && lhs.m_frequencykHz == rhs.m_frequencykHz && - lhs.m_facility == rhs.m_facility && + lhs.m_facility == rhs.m_facility && lhs.m_visibleRange == rhs.m_visibleRange && - lhs.m_rating == rhs.m_rating && - qFuzzyCompare(1 + lhs.m_latitude, 1 + rhs.m_latitude) && + lhs.m_rating == rhs.m_rating && + qFuzzyCompare(1 + lhs.m_latitude, 1 + rhs.m_latitude) && qFuzzyCompare(1 + lhs.m_longitude, 1 + rhs.m_longitude) && - lhs.m_elevation == rhs.m_elevation; + lhs.m_elevation == rhs.m_elevation; } //! Not equal to operator