[FSD] Style and minor fix, check for network ICAO 1st and not for simulator model (correct display)

This commit is contained in:
Klaus Basan
2019-11-12 01:29:36 +01:00
committed by Mat Sutcliffe
parent ff2ab95367
commit e9f8be013c
4 changed files with 18 additions and 27 deletions

View File

@@ -1309,7 +1309,7 @@ namespace BlackCore
void CAircraftMatcher::evaluateStatisticsEntry(const QString &sessionId, const CCallsign &callsign, const QString &aircraftIcao, const QString &airlineIcao, const QString &livery) void CAircraftMatcher::evaluateStatisticsEntry(const QString &sessionId, const CCallsign &callsign, const QString &aircraftIcao, const QString &airlineIcao, const QString &livery)
{ {
Q_UNUSED(livery); Q_UNUSED(livery)
Q_ASSERT_X(sApp && sApp->hasWebDataServices(), Q_FUNC_INFO, "Missing web data services"); Q_ASSERT_X(sApp && sApp->hasWebDataServices(), Q_FUNC_INFO, "Missing web data services");
if (m_modelSet.isEmpty()) { return; } // ignore empty sets to not create silly stats if (m_modelSet.isEmpty()) { return; } // ignore empty sets to not create silly stats
if (sessionId.isEmpty()) { return; } if (sessionId.isEmpty()) { return; }

View File

@@ -703,7 +703,7 @@ namespace BlackCore
else if (queryType == ClientQueryType::Server) else if (queryType == ClientQueryType::Server)
{ {
responseData.push_back(m_server.getAddress()); responseData.push_back(m_server.getAddress());
ClientResponse pduClientQueryResponse(m_ownCallsign.asString(), receiver, ClientQueryType::Server, responseData); const ClientResponse pduClientQueryResponse(m_ownCallsign.asString(), receiver, ClientQueryType::Server, responseData);
sendMessage(pduClientQueryResponse); sendMessage(pduClientQueryResponse);
} }
else if (queryType == ClientQueryType::ATIS) else if (queryType == ClientQueryType::ATIS)
@@ -973,7 +973,6 @@ namespace BlackCore
void CFSDClient::handleFlightPlan(const QStringList &tokens) void CFSDClient::handleFlightPlan(const QStringList &tokens)
{ {
FlightPlan fp = FlightPlan::fromTokens(tokens); FlightPlan fp = FlightPlan::fromTokens(tokens);
CFlightPlan::FlightRules rules = CFlightPlan::VFR; CFlightPlan::FlightRules rules = CFlightPlan::VFR;
switch (fp.m_flightType) switch (fp.m_flightType)
@@ -1045,54 +1044,42 @@ namespace BlackCore
{ {
ClientQuery clientQuery = ClientQuery::fromTokens(tokens); ClientQuery clientQuery = ClientQuery::fromTokens(tokens);
if (clientQuery.m_queryType == ClientQueryType::Unknown) if (clientQuery.m_queryType == ClientQueryType::Unknown) { return; }
{ if (clientQuery.m_queryType == ClientQueryType::IsValidATC)
return;
}
else if (clientQuery.m_queryType == ClientQueryType::IsValidATC)
{ {
// This is usually sent to the server only. If it ever arrives here, just ignore it. // This is usually sent to the server only. If it ever arrives here, just ignore it.
return;
} }
else if (clientQuery.m_queryType == ClientQueryType::Capabilities) else if (clientQuery.m_queryType == ClientQueryType::Capabilities)
{ {
sendClientResponse(ClientQueryType::Capabilities, clientQuery.sender()); sendClientResponse(ClientQueryType::Capabilities, clientQuery.sender());
return;
} }
else if (clientQuery.m_queryType == ClientQueryType::Com1Freq) else if (clientQuery.m_queryType == ClientQueryType::Com1Freq)
{ {
sendClientResponse(ClientQueryType::Com1Freq, clientQuery.sender()); sendClientResponse(ClientQueryType::Com1Freq, clientQuery.sender());
return;
} }
else if (clientQuery.m_queryType == ClientQueryType::RealName) else if (clientQuery.m_queryType == ClientQueryType::RealName)
{ {
sendClientResponse(ClientQueryType::RealName, clientQuery.sender()); sendClientResponse(ClientQueryType::RealName, clientQuery.sender());
return;
} }
else if (clientQuery.m_queryType == ClientQueryType::Server) else if (clientQuery.m_queryType == ClientQueryType::Server)
{ {
sendClientResponse(ClientQueryType::Server, clientQuery.sender()); sendClientResponse(ClientQueryType::Server, clientQuery.sender());
return;
} }
else if (clientQuery.m_queryType == ClientQueryType::ATIS) else if (clientQuery.m_queryType == ClientQueryType::ATIS)
{ {
// This is answered by ATC clients only. If we get such a request, ignore it. // This is answered by ATC clients only. If we get such a request, ignore it.
return;
} }
else if (clientQuery.m_queryType == ClientQueryType::PublicIP) else if (clientQuery.m_queryType == ClientQueryType::PublicIP)
{ {
// This is usually sent to the server only. If it ever arrives here, just ignore it. // This is usually sent to the server only. If it ever arrives here, just ignore it.
return;
} }
else if (clientQuery.m_queryType == ClientQueryType::INF) else if (clientQuery.m_queryType == ClientQueryType::INF)
{ {
sendClientResponse(ClientQueryType::INF, clientQuery.sender()); sendClientResponse(ClientQueryType::INF, clientQuery.sender());
return;
} }
else if (clientQuery.m_queryType == ClientQueryType::FP) else if (clientQuery.m_queryType == ClientQueryType::FP)
{ {
// This is usually sent to the server only. If it ever arrives here, just ignore it. // This is usually sent to the server only. If it ever arrives here, just ignore it.
return;
} }
else if (clientQuery.m_queryType == ClientQueryType::AircraftConfig) else if (clientQuery.m_queryType == ClientQueryType::AircraftConfig)
{ {
@@ -1131,7 +1118,6 @@ namespace BlackCore
const qint64 offsetTimeMs = currentOffsetTime(callsign); const qint64 offsetTimeMs = currentOffsetTime(callsign);
emit aircraftConfigReceived(clientQuery.sender(), config, offsetTimeMs); emit aircraftConfigReceived(clientQuery.sender(), config, offsetTimeMs);
return;
} }
} }
@@ -1841,7 +1827,10 @@ namespace BlackCore
{ {
m_positionUpdateTimer.start(c_updatePostionIntervalMsec); m_positionUpdateTimer.start(c_updatePostionIntervalMsec);
m_scheduledConfigUpdate.start(c_processingIntervalMsec); m_scheduledConfigUpdate.start(c_processingIntervalMsec);
// interim positions
if (this->isInterimPositionSendingEnabledForServer()) { m_interimPositionUpdateTimer.start(c_updateInterimPostionIntervalMsec); } if (this->isInterimPositionSendingEnabledForServer()) { m_interimPositionUpdateTimer.start(c_updateInterimPostionIntervalMsec); }
else { m_interimPositionUpdateTimer.stop(); }
} }
void CFSDClient::stopPositionTimers() void CFSDClient::stopPositionTimers()

View File

@@ -47,7 +47,7 @@ namespace BlackCore
{ {
BlackMisc::CLogMessage(static_cast<PlaneInformation *>(nullptr)).debug(u"Wrong number of arguments."); BlackMisc::CLogMessage(static_cast<PlaneInformation *>(nullptr)).debug(u"Wrong number of arguments.");
return {}; return {};
}; }
QString aircraft; QString aircraft;
QString airline; QString airline;
@@ -55,7 +55,7 @@ namespace BlackCore
for (int i = 4; i < tokens.size(); ++i) for (int i = 4; i < tokens.size(); ++i)
{ {
QStringList pair = tokens.at(i).split("="); const QStringList pair = tokens.at(i).split("=");
if (pair.size() == 2) if (pair.size() == 2)
{ {
if (pair[0] == QLatin1String("EQUIPMENT")) { aircraft = pair[1]; } if (pair[0] == QLatin1String("EQUIPMENT")) { aircraft = pair[1]; }

View File

@@ -460,10 +460,12 @@ namespace BlackMisc
QString CSimulatedAircraft::getNetworkModelAircraftIcaoDifference() const QString CSimulatedAircraft::getNetworkModelAircraftIcaoDifference() const
{ {
const CAircraftIcaoCode icao(this->getModel().getAircraftIcaoCode());
const CAircraftIcaoCode icaoNw(this->getNetworkModel().getAircraftIcaoCode()); const CAircraftIcaoCode icaoNw(this->getNetworkModel().getAircraftIcaoCode());
if (!icao.hasDesignator()) { return QStringLiteral("[x] no sim."); }
if (!icaoNw.hasDesignator()) { return QStringLiteral("[x] no nw."); } if (!icaoNw.hasDesignator()) { return QStringLiteral("[x] no nw."); }
const CAircraftIcaoCode icao(this->getModel().getAircraftIcaoCode());
if (!icao.hasDesignator()) { return QStringLiteral("[x] no sim."); }
if (icao.isDbEqual(icaoNw) || icao == icaoNw) { return u"[==] " % icao.getDesignatorDbKey(); } if (icao.isDbEqual(icaoNw) || icao == icaoNw) { return u"[==] " % icao.getDesignatorDbKey(); }
if (icao.getDesignator() == icaoNw.getDesignator()) { return u"[=] " % icao.getDesignator(); } if (icao.getDesignator() == icaoNw.getDesignator()) { return u"[=] " % icao.getDesignator(); }
return QStringLiteral("%1 -> %2").arg(icaoNw.getDesignator(), icao.getDesignator()); return QStringLiteral("%1 -> %2").arg(icaoNw.getDesignator(), icao.getDesignator());