From b22ffae2fbd5a12247fdad15ef55b163cf8992af Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sun, 7 Oct 2018 15:06:30 +0200 Subject: [PATCH] Ref T385, not all "_OBS" observers are ATC, they can be copilots too --- src/blackmisc/network/user.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/blackmisc/network/user.cpp b/src/blackmisc/network/user.cpp index 664fd41eb..2dcb1d259 100644 --- a/src/blackmisc/network/user.cpp +++ b/src/blackmisc/network/user.cpp @@ -84,7 +84,16 @@ namespace BlackMisc { if (m_callsign.isAtcCallsign()) { - m_homebase = m_callsign.getIcaoCode(); + // option 1: real ATC station + // option 2: a copilot cmoning in Observer + if (m_callsign.isObserverCallsign()) + { + // copilot + } + else + { + m_homebase = m_callsign.getIcaoCode(); + } } } } @@ -102,10 +111,8 @@ namespace BlackMisc { // only apply stripping if home base is not explicitly given // try to strip homebase: I understand the limitations, but we will have more correct hits as failures I assume - static QThreadStorage tsRegex; - if (! tsRegex.hasLocalData()) { tsRegex.setLocalData(QRegularExpression("(-\\s*|\\s)([A-Z]{4})$")); } - const auto ®ex = tsRegex.localData(); - const QRegularExpressionMatch match = regex.match(rn); + thread_local QRegularExpression tsRegex("(-\\s*|\\s)([A-Z]{4})$"); + const QRegularExpressionMatch match = tsRegex.match(rn); if (match.hasMatch()) { const int pos = match.capturedStart(0);