mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
[FSD] Style and minor fix, check for network ICAO 1st and not for simulator model (correct display)
This commit is contained in:
committed by
Mat Sutcliffe
parent
ff2ab95367
commit
e9f8be013c
@@ -1309,7 +1309,7 @@ namespace BlackCore
|
||||
|
||||
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");
|
||||
if (m_modelSet.isEmpty()) { return; } // ignore empty sets to not create silly stats
|
||||
if (sessionId.isEmpty()) { return; }
|
||||
|
||||
@@ -703,7 +703,7 @@ namespace BlackCore
|
||||
else if (queryType == ClientQueryType::Server)
|
||||
{
|
||||
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);
|
||||
}
|
||||
else if (queryType == ClientQueryType::ATIS)
|
||||
@@ -973,7 +973,6 @@ namespace BlackCore
|
||||
void CFSDClient::handleFlightPlan(const QStringList &tokens)
|
||||
{
|
||||
FlightPlan fp = FlightPlan::fromTokens(tokens);
|
||||
|
||||
CFlightPlan::FlightRules rules = CFlightPlan::VFR;
|
||||
|
||||
switch (fp.m_flightType)
|
||||
@@ -1045,54 +1044,42 @@ namespace BlackCore
|
||||
{
|
||||
ClientQuery clientQuery = ClientQuery::fromTokens(tokens);
|
||||
|
||||
if (clientQuery.m_queryType == ClientQueryType::Unknown)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (clientQuery.m_queryType == ClientQueryType::IsValidATC)
|
||||
if (clientQuery.m_queryType == ClientQueryType::Unknown) { return; }
|
||||
if (clientQuery.m_queryType == ClientQueryType::IsValidATC)
|
||||
{
|
||||
// This is usually sent to the server only. If it ever arrives here, just ignore it.
|
||||
return;
|
||||
}
|
||||
else if (clientQuery.m_queryType == ClientQueryType::Capabilities)
|
||||
{
|
||||
sendClientResponse(ClientQueryType::Capabilities, clientQuery.sender());
|
||||
return;
|
||||
}
|
||||
else if (clientQuery.m_queryType == ClientQueryType::Com1Freq)
|
||||
{
|
||||
sendClientResponse(ClientQueryType::Com1Freq, clientQuery.sender());
|
||||
return;
|
||||
}
|
||||
else if (clientQuery.m_queryType == ClientQueryType::RealName)
|
||||
{
|
||||
sendClientResponse(ClientQueryType::RealName, clientQuery.sender());
|
||||
return;
|
||||
}
|
||||
else if (clientQuery.m_queryType == ClientQueryType::Server)
|
||||
{
|
||||
sendClientResponse(ClientQueryType::Server, clientQuery.sender());
|
||||
return;
|
||||
}
|
||||
else if (clientQuery.m_queryType == ClientQueryType::ATIS)
|
||||
{
|
||||
// This is answered by ATC clients only. If we get such a request, ignore it.
|
||||
return;
|
||||
}
|
||||
else if (clientQuery.m_queryType == ClientQueryType::PublicIP)
|
||||
{
|
||||
// This is usually sent to the server only. If it ever arrives here, just ignore it.
|
||||
return;
|
||||
}
|
||||
else if (clientQuery.m_queryType == ClientQueryType::INF)
|
||||
{
|
||||
sendClientResponse(ClientQueryType::INF, clientQuery.sender());
|
||||
return;
|
||||
}
|
||||
else if (clientQuery.m_queryType == ClientQueryType::FP)
|
||||
{
|
||||
// This is usually sent to the server only. If it ever arrives here, just ignore it.
|
||||
return;
|
||||
}
|
||||
else if (clientQuery.m_queryType == ClientQueryType::AircraftConfig)
|
||||
{
|
||||
@@ -1131,7 +1118,6 @@ namespace BlackCore
|
||||
|
||||
const qint64 offsetTimeMs = currentOffsetTime(callsign);
|
||||
emit aircraftConfigReceived(clientQuery.sender(), config, offsetTimeMs);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1841,7 +1827,10 @@ namespace BlackCore
|
||||
{
|
||||
m_positionUpdateTimer.start(c_updatePostionIntervalMsec);
|
||||
m_scheduledConfigUpdate.start(c_processingIntervalMsec);
|
||||
|
||||
// interim positions
|
||||
if (this->isInterimPositionSendingEnabledForServer()) { m_interimPositionUpdateTimer.start(c_updateInterimPostionIntervalMsec); }
|
||||
else { m_interimPositionUpdateTimer.stop(); }
|
||||
}
|
||||
|
||||
void CFSDClient::stopPositionTimers()
|
||||
|
||||
@@ -29,8 +29,8 @@ namespace BlackCore
|
||||
{
|
||||
QStringList pairs;
|
||||
if (!m_aircraft.isEmpty()) { pairs << QString("EQUIPMENT=" + m_aircraft); }
|
||||
if (!m_airline.isEmpty()) { pairs << QString("AIRLINE=" + m_airline); }
|
||||
if (!m_livery.isEmpty()) { pairs << QString("LIVERY=" + m_livery); }
|
||||
if (!m_airline.isEmpty()) { pairs << QString("AIRLINE=" + m_airline); }
|
||||
if (!m_livery.isEmpty()) { pairs << QString("LIVERY=" + m_livery); }
|
||||
|
||||
QStringList tokens;
|
||||
tokens.push_back(m_sender);
|
||||
@@ -47,7 +47,7 @@ namespace BlackCore
|
||||
{
|
||||
BlackMisc::CLogMessage(static_cast<PlaneInformation *>(nullptr)).debug(u"Wrong number of arguments.");
|
||||
return {};
|
||||
};
|
||||
}
|
||||
|
||||
QString aircraft;
|
||||
QString airline;
|
||||
@@ -55,12 +55,12 @@ namespace BlackCore
|
||||
|
||||
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[0] == QLatin1String("EQUIPMENT")) { aircraft = pair[1]; }
|
||||
else if (pair[0] == QLatin1String("AIRLINE")) { airline = pair[1]; }
|
||||
else if (pair[0] == QLatin1String("LIVERY")) { livery = pair[1]; }
|
||||
if (pair[0] == QLatin1String("EQUIPMENT")) { aircraft = pair[1]; }
|
||||
else if (pair[0] == QLatin1String("AIRLINE")) { airline = pair[1]; }
|
||||
else if (pair[0] == QLatin1String("LIVERY")) { livery = pair[1]; }
|
||||
}
|
||||
}
|
||||
return PlaneInformation(tokens[0], tokens[1], aircraft, airline, livery);
|
||||
|
||||
@@ -460,10 +460,12 @@ namespace BlackMisc
|
||||
|
||||
QString CSimulatedAircraft::getNetworkModelAircraftIcaoDifference() const
|
||||
{
|
||||
const CAircraftIcaoCode icao(this->getModel().getAircraftIcaoCode());
|
||||
const CAircraftIcaoCode icaoNw(this->getNetworkModel().getAircraftIcaoCode());
|
||||
if (!icao.hasDesignator()) { return QStringLiteral("[x] no sim."); }
|
||||
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.getDesignator() == icaoNw.getDesignator()) { return u"[=] " % icao.getDesignator(); }
|
||||
return QStringLiteral("%1 -> %2").arg(icaoNw.getDesignator(), icao.getDesignator());
|
||||
|
||||
Reference in New Issue
Block a user