mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +08:00
Extract method to convert between FlightRules and FlightType
This commit is contained in:
@@ -704,15 +704,7 @@ namespace BlackCore::Fsd
|
|||||||
QString act = flightPlan.getCombinedPrefixIcaoSuffix();
|
QString act = flightPlan.getCombinedPrefixIcaoSuffix();
|
||||||
if (act.isEmpty()) { act = flightPlan.getAircraftIcao().getDesignator(); } // fallback
|
if (act.isEmpty()) { act = flightPlan.getAircraftIcao().getDesignator(); } // fallback
|
||||||
|
|
||||||
FlightType flightType = FlightType::IFR;
|
FlightType flightType = getFlightType(flightPlan.getFlightRules());
|
||||||
switch (flightPlan.getFlightRules())
|
|
||||||
{
|
|
||||||
case CFlightPlan::IFR: flightType = FlightType::IFR; break;
|
|
||||||
case CFlightPlan::VFR: flightType = FlightType::VFR; break;
|
|
||||||
case CFlightPlan::SVFR: flightType = FlightType::SVFR; break;
|
|
||||||
case CFlightPlan::DVFR: flightType = FlightType::DVFR; break;
|
|
||||||
default: flightType = FlightType::IFR; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QList<int> timePartsEnroute = flightPlan.getEnrouteTime().getHrsMinSecParts();
|
const QList<int> timePartsEnroute = flightPlan.getEnrouteTime().getHrsMinSecParts();
|
||||||
const QList<int> timePartsFuel = flightPlan.getFuelTime().getHrsMinSecParts();
|
const QList<int> timePartsFuel = flightPlan.getFuelTime().getHrsMinSecParts();
|
||||||
@@ -2409,6 +2401,18 @@ namespace BlackCore::Fsd
|
|||||||
return copy.remove(':');
|
return copy.remove(':');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FlightType CFSDClient::getFlightType(CFlightPlan::FlightRules flightRules)
|
||||||
|
{
|
||||||
|
switch (flightRules)
|
||||||
|
{
|
||||||
|
case CFlightPlan::IFR: return FlightType::IFR;
|
||||||
|
case CFlightPlan::VFR: return FlightType::VFR;
|
||||||
|
case CFlightPlan::SVFR: return FlightType::SVFR;
|
||||||
|
case CFlightPlan::DVFR: return FlightType::DVFR;
|
||||||
|
default: return FlightType::IFR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const QString &CFSDClient::messageTypeToString(MessageType mt) const
|
const QString &CFSDClient::messageTypeToString(MessageType mt) const
|
||||||
{
|
{
|
||||||
QHash<QString, MessageType>::const_iterator i = m_messageTypeMapping.constBegin();
|
QHash<QString, MessageType>::const_iterator i = m_messageTypeMapping.constBegin();
|
||||||
|
|||||||
@@ -461,6 +461,9 @@ namespace BlackCore::Fsd
|
|||||||
//! Get a short-lived, one-time-use token from Vatsim web service, to avoid sending plaintext password to FSD
|
//! Get a short-lived, one-time-use token from Vatsim web service, to avoid sending plaintext password to FSD
|
||||||
void getVatsimAuthToken(const QString &cid, const QString &password, const BlackMisc::CSlot<void(const QString &)> &callback);
|
void getVatsimAuthToken(const QString &cid, const QString &password, const BlackMisc::CSlot<void(const QString &)> &callback);
|
||||||
|
|
||||||
|
//! Convert FlightRules to FlightType
|
||||||
|
static FlightType getFlightType(BlackMisc::Aviation::CFlightPlan::FlightRules flightRule);
|
||||||
|
|
||||||
vatsim_auth *m_clientAuth = nullptr;
|
vatsim_auth *m_clientAuth = nullptr;
|
||||||
vatsim_auth *m_serverAuth = nullptr;
|
vatsim_auth *m_serverAuth = nullptr;
|
||||||
QString m_lastServerAuthChallenge;
|
QString m_lastServerAuthChallenge;
|
||||||
|
|||||||
Reference in New Issue
Block a user