mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 04:25:42 +08:00
Style
This commit is contained in:
@@ -20,10 +20,6 @@ using namespace BlackMisc::Simulation::Fsx;
|
|||||||
|
|
||||||
namespace BlackSample
|
namespace BlackSample
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
|
||||||
* Samples
|
|
||||||
*/
|
|
||||||
void CSamplesFsx::samplesMisc(QTextStream &streamOut)
|
void CSamplesFsx::samplesMisc(QTextStream &streamOut)
|
||||||
{
|
{
|
||||||
BlackMisc::registerMetadata();
|
BlackMisc::registerMetadata();
|
||||||
|
|||||||
@@ -633,8 +633,7 @@ namespace BlackCore
|
|||||||
m_aircraftMatcher.clearMatchingStatistics();
|
m_aircraftMatcher.clearMatchingStatistics();
|
||||||
m_matchingMessages.clear();
|
m_matchingMessages.clear();
|
||||||
|
|
||||||
// check in case the plugin has been unloaded
|
if (m_simulatorPlugin.second) // check in case the plugin has been unloaded
|
||||||
if (m_simulatorPlugin.second)
|
|
||||||
{
|
{
|
||||||
const CStatusMessageList verifyMessages = m_simulatorPlugin.second->debugVerifyStateAfterAllAircraftRemoved();
|
const CStatusMessageList verifyMessages = m_simulatorPlugin.second->debugVerifyStateAfterAllAircraftRemoved();
|
||||||
m_simulatorPlugin.second->clearAllRemoteAircraftData();
|
m_simulatorPlugin.second->clearAllRemoteAircraftData();
|
||||||
|
|||||||
@@ -130,6 +130,9 @@ namespace BlackGui
|
|||||||
//! Ctor
|
//! Ctor
|
||||||
CLoadIndicatorEnabled(QWidget *usingWidget);
|
CLoadIndicatorEnabled(QWidget *usingWidget);
|
||||||
|
|
||||||
|
//! Destructor
|
||||||
|
virtual ~CLoadIndicatorEnabled() {}
|
||||||
|
|
||||||
//! Showing load indicator?
|
//! Showing load indicator?
|
||||||
bool isShowingLoadIndicator() const;
|
bool isShowingLoadIndicator() const;
|
||||||
|
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ namespace BlackMisc
|
|||||||
static QString fixWindowsUncPath(const QString &filePath);
|
static QString fixWindowsUncPath(const QString &filePath);
|
||||||
|
|
||||||
//! Fix UNC file paths
|
//! Fix UNC file paths
|
||||||
|
//! \remark will do nothing on OS other than Windows
|
||||||
static QStringList fixWindowsUncPaths(const QStringList &filePaths);
|
static QStringList fixWindowsUncPaths(const QStringList &filePaths);
|
||||||
|
|
||||||
//! Windows UNC path?
|
//! Windows UNC path?
|
||||||
|
|||||||
@@ -46,10 +46,10 @@ namespace BlackMisc
|
|||||||
class BLACKMISC_EXPORT IRemoteAircraftProvider : public IProvider
|
class BLACKMISC_EXPORT IRemoteAircraftProvider : public IProvider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static constexpr int MaxSituationsPerCallsign = 6; //!< How many situations we keep per callsign
|
static constexpr int MaxSituationsPerCallsign = 6; //!< How many situations we keep per callsign
|
||||||
static constexpr int MaxPartsPerCallsign = 20; //!< How many parts we keep per callsign (we keep more parts than situations as parts can just come in)
|
static constexpr int MaxPartsPerCallsign = 20; //!< How many parts we keep per callsign (we keep more parts than situations as parts can just come in)
|
||||||
static constexpr int MaxPartsAgePerCallsignSecs = 60; //!< How many seconds to keep parts for interpolation
|
static constexpr int MaxPartsAgePerCallsignSecs = 60; //!< How many seconds to keep parts for interpolation
|
||||||
static constexpr int DefaultOffsetTimeMs = 6000; //!< \fixme copied from CNetworkVatlib::c_positionTimeOffsetMsec
|
static constexpr int DefaultOffsetTimeMs = 6000; //!< \fixme copied from CNetworkVatlib::c_positionTimeOffsetMsec
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~IRemoteAircraftProvider() {}
|
virtual ~IRemoteAircraftProvider() {}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CSimulatorFsCommon();
|
virtual ~CSimulatorFsCommon() override;
|
||||||
|
|
||||||
//! FSUIPC connected?
|
//! FSUIPC connected?
|
||||||
bool isFsuipcConnected() const;
|
bool isFsuipcConnected() const;
|
||||||
|
|||||||
@@ -41,29 +41,30 @@ namespace BlackSimPlugin
|
|||||||
double velocity; //!< Ground velocity
|
double velocity; //!< Ground velocity
|
||||||
double elevation; //!< Elevation (ft)
|
double elevation; //!< Elevation (ft)
|
||||||
double simOnGround; //!< Is aircraft on ground?
|
double simOnGround; //!< Is aircraft on ground?
|
||||||
|
// 12
|
||||||
double lightStrobe; //!< Is strobe light on?
|
double lightStrobe; //!< Is strobe light on?
|
||||||
double lightLanding; //!< Is landing light on?
|
double lightLanding; //!< Is landing light on?
|
||||||
double lightTaxi; //!< Is taxi light on?
|
double lightTaxi; //!< Is taxi light on?
|
||||||
double lightBeacon; //!< Is beacon light on?
|
double lightBeacon; //!< Is beacon light on?
|
||||||
double lightNav; //!< Is nav light on?
|
double lightNav; //!< Is nav light on?
|
||||||
double lightLogo; //!< Is logo light on?
|
double lightLogo; //!< Is logo light on?
|
||||||
|
// 18
|
||||||
double transponderCode; //!< Transponder Code
|
double transponderCode; //!< Transponder Code
|
||||||
double com1ActiveMHz; //!< COM1 active frequency
|
double com1ActiveMHz; //!< COM1 active frequency
|
||||||
double com2ActiveMHz; //!< COM2 active frequency
|
double com2ActiveMHz; //!< COM2 active frequency
|
||||||
double com1StandbyMHz; //!< COM1 standby frequency
|
double com1StandbyMHz; //!< COM1 standby frequency
|
||||||
double com2StandbyMHz; //!< COM1 standby frequency
|
double com2StandbyMHz; //!< COM1 standby frequency
|
||||||
|
// 23
|
||||||
double flapsHandlePosition; //!< Flaps handle position in percent
|
double flapsHandlePosition; //!< Flaps handle position in percent
|
||||||
double spoilersHandlePosition; //!< Spoilers out? (flag)
|
double spoilersHandlePosition; //!< Spoilers out? (flag)
|
||||||
double gearHandlePosition; //!< Gear handle position (flag)
|
double gearHandlePosition; //!< Gear handle position (flag)
|
||||||
|
// 26
|
||||||
double numberOfEngines; //!< Number of engines
|
double numberOfEngines; //!< Number of engines
|
||||||
double engine1Combustion; //!< Engine 1 combustion flag
|
double engine1Combustion; //!< Engine 1 combustion flag
|
||||||
double engine2Combustion; //!< Engine 2 combustion flag
|
double engine2Combustion; //!< Engine 2 combustion flag
|
||||||
double engine3Combustion; //!< Engine 3 combustion flag
|
double engine3Combustion; //!< Engine 3 combustion flag
|
||||||
double engine4Combustion; //!< Engine 4 combustion flag
|
double engine4Combustion; //!< Engine 4 combustion flag
|
||||||
|
//31
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Data struct of aircraft position
|
//! Data struct of aircraft position
|
||||||
|
|||||||
@@ -47,21 +47,21 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
case SIMCONNECT_RECV_ID_OPEN:
|
case SIMCONNECT_RECV_ID_OPEN:
|
||||||
{
|
{
|
||||||
SIMCONNECT_RECV_OPEN *event = (SIMCONNECT_RECV_OPEN *)pData;
|
SIMCONNECT_RECV_OPEN *event = static_cast<SIMCONNECT_RECV_OPEN *>(pData);
|
||||||
const QString simConnectVersion = QString("%1.%2.%3.%4").arg(event->dwSimConnectVersionMajor).arg(event->dwSimConnectVersionMinor).arg(event->dwSimConnectBuildMajor).arg(event->dwSimConnectBuildMinor);
|
const QString simConnectVersion = QString("%1.%2.%3.%4").arg(event->dwSimConnectVersionMajor).arg(event->dwSimConnectVersionMinor).arg(event->dwSimConnectBuildMajor).arg(event->dwSimConnectBuildMinor);
|
||||||
const QString version = QString("%1.%2.%3.%4").arg(event->dwApplicationVersionMajor).arg(event->dwApplicationVersionMinor).arg(event->dwApplicationBuildMajor).arg(event->dwApplicationBuildMinor);
|
const QString version = QString("%1.%2.%3.%4").arg(event->dwApplicationVersionMajor).arg(event->dwApplicationVersionMinor).arg(event->dwApplicationBuildMajor).arg(event->dwApplicationBuildMinor);
|
||||||
const QString name = CSimulatorFsxCommon::fsxCharToQString(event->szApplicationName);
|
const QString name = CSimulatorFsxCommon::fsxCharToQString(event->szApplicationName);
|
||||||
const QString details = QString("Name: '%1' Version: %2 SimConnect: %3").arg(name, version, simConnectVersion);
|
const QString details = QString("Name: '%1' Version: %2 SimConnect: %3").arg(name, version, simConnectVersion);
|
||||||
simulatorFsxP3D->setSimulatorDetails(name, details, version);
|
simulatorFsxP3D->setSimulatorDetails(name, details, version);
|
||||||
simulatorFsxP3D->m_simConnectVersion = simConnectVersion;
|
simulatorFsxP3D->m_simConnectVersion = simConnectVersion;
|
||||||
CLogMessage(static_cast<CSimulatorFsxCommon *>(nullptr)).info("Connected to %1: '%2'") << simulatorFsxP3D->getSimulatorPluginInfo().getIdentifier() << details;
|
CLogMessage(simulatorFsxP3D).info("Connected to %1: '%2'") << simulatorFsxP3D->getSimulatorPluginInfo().getIdentifier() << details;
|
||||||
simulatorFsxP3D->setSimConnected();
|
simulatorFsxP3D->setSimConnected();
|
||||||
break; // SIMCONNECT_RECV_ID_OPEN
|
break; // SIMCONNECT_RECV_ID_OPEN
|
||||||
}
|
}
|
||||||
case SIMCONNECT_RECV_ID_EXCEPTION:
|
case SIMCONNECT_RECV_ID_EXCEPTION:
|
||||||
{
|
{
|
||||||
if (!simulatorFsxP3D->stillDisplayReceiveExceptions()) { break; }
|
if (!simulatorFsxP3D->stillDisplayReceiveExceptions()) { break; }
|
||||||
SIMCONNECT_RECV_EXCEPTION *exception = (SIMCONNECT_RECV_EXCEPTION *)pData;
|
SIMCONNECT_RECV_EXCEPTION *exception = static_cast<SIMCONNECT_RECV_EXCEPTION *>(pData);
|
||||||
const DWORD exceptionId = exception->dwException;
|
const DWORD exceptionId = exception->dwException;
|
||||||
const DWORD sendId = exception->dwSendID;
|
const DWORD sendId = exception->dwSendID;
|
||||||
const DWORD index = exception->dwIndex;
|
const DWORD index = exception->dwIndex;
|
||||||
@@ -75,7 +75,7 @@ namespace BlackSimPlugin
|
|||||||
}
|
}
|
||||||
QString ex;
|
QString ex;
|
||||||
ex.sprintf("Exception=%lu | SendID=%lu | Index=%lu | cbData=%lu", exceptionId, sendId, index, data);
|
ex.sprintf("Exception=%lu | SendID=%lu | Index=%lu | cbData=%lu", exceptionId, sendId, index, data);
|
||||||
const QString exceptionString(CSimConnectUtilities::simConnectExceptionToString((SIMCONNECT_EXCEPTION)exception->dwException));
|
const QString exceptionString(CSimConnectUtilities::simConnectExceptionToString(static_cast<DWORD>(exception->dwException)));
|
||||||
const QString sendIdDetails = simulatorFsxP3D->getSendIdTraceDetails(sendId);
|
const QString sendIdDetails = simulatorFsxP3D->getSendIdTraceDetails(sendId);
|
||||||
CLogMessage(simulatorFsxP3D).warning("Caught simConnect exception: '%1' '%2' | send details: '%3'")
|
CLogMessage(simulatorFsxP3D).warning("Caught simConnect exception: '%1' '%2' | send details: '%3'")
|
||||||
<< exceptionString << ex
|
<< exceptionString << ex
|
||||||
@@ -162,7 +162,7 @@ namespace BlackSimPlugin
|
|||||||
}
|
}
|
||||||
case SIMCONNECT_RECV_ID_EVENT_FRAME:
|
case SIMCONNECT_RECV_ID_EVENT_FRAME:
|
||||||
{
|
{
|
||||||
const SIMCONNECT_RECV_EVENT_FRAME *event = (SIMCONNECT_RECV_EVENT_FRAME *) pData;
|
const SIMCONNECT_RECV_EVENT_FRAME *event = static_cast<SIMCONNECT_RECV_EVENT_FRAME *>(pData);
|
||||||
switch (event->uEventID)
|
switch (event->uEventID)
|
||||||
{
|
{
|
||||||
case SystemEventFrame:
|
case SystemEventFrame:
|
||||||
@@ -220,7 +220,7 @@ namespace BlackSimPlugin
|
|||||||
}
|
}
|
||||||
case SIMCONNECT_RECV_ID_SIMOBJECT_DATA:
|
case SIMCONNECT_RECV_ID_SIMOBJECT_DATA:
|
||||||
{
|
{
|
||||||
const SIMCONNECT_RECV_SIMOBJECT_DATA *pObjData = (SIMCONNECT_RECV_SIMOBJECT_DATA *) pData;
|
const SIMCONNECT_RECV_SIMOBJECT_DATA *pObjData = static_cast<SIMCONNECT_RECV_SIMOBJECT_DATA *>(pData);
|
||||||
const DWORD requestId = pObjData->dwRequestID;
|
const DWORD requestId = pObjData->dwRequestID;
|
||||||
simulatorFsxP3D->m_dispatchRequestIdLast = requestId;
|
simulatorFsxP3D->m_dispatchRequestIdLast = requestId;
|
||||||
|
|
||||||
@@ -229,20 +229,20 @@ namespace BlackSimPlugin
|
|||||||
case CSimConnectDefinitions::RequestOwnAircraft:
|
case CSimConnectDefinitions::RequestOwnAircraft:
|
||||||
{
|
{
|
||||||
static_assert(sizeof(DataDefinitionOwnAircraft) == 31 * sizeof(double), "DataDefinitionOwnAircraft has an incorrect size.");
|
static_assert(sizeof(DataDefinitionOwnAircraft) == 31 * sizeof(double), "DataDefinitionOwnAircraft has an incorrect size.");
|
||||||
const DataDefinitionOwnAircraft *ownAircaft = (DataDefinitionOwnAircraft *)&pObjData->dwData;
|
const DataDefinitionOwnAircraft *ownAircaft = reinterpret_cast<const DataDefinitionOwnAircraft *>(&pObjData->dwData);
|
||||||
simulatorFsxP3D->updateOwnAircraftFromSimulator(*ownAircaft);
|
simulatorFsxP3D->updateOwnAircraftFromSimulator(*ownAircaft);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CSimConnectDefinitions::RequestOwnAircraftTitle:
|
case CSimConnectDefinitions::RequestOwnAircraftTitle:
|
||||||
{
|
{
|
||||||
const DataDefinitionOwnAircraftModel *dataDefinitionModel = (DataDefinitionOwnAircraftModel *) &pObjData->dwData;
|
const DataDefinitionOwnAircraftModel *dataDefinitionModel = reinterpret_cast<const DataDefinitionOwnAircraftModel *>(&pObjData->dwData);
|
||||||
const CAircraftModel model(dataDefinitionModel->title, CAircraftModel::TypeOwnSimulatorModel);
|
const CAircraftModel model(dataDefinitionModel->title, CAircraftModel::TypeOwnSimulatorModel);
|
||||||
simulatorFsxP3D->reverseLookupAndUpdateOwnAircraftModel(model);
|
simulatorFsxP3D->reverseLookupAndUpdateOwnAircraftModel(model);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CSimConnectDefinitions::RequestSimEnvironment:
|
case CSimConnectDefinitions::RequestSimEnvironment:
|
||||||
{
|
{
|
||||||
const DataDefinitionSimEnvironment *simEnv = (DataDefinitionSimEnvironment *) &pObjData->dwData;
|
const DataDefinitionSimEnvironment *simEnv = reinterpret_cast<const DataDefinitionSimEnvironment *>(&pObjData->dwData);
|
||||||
if (simulatorFsxP3D->isTimeSynchronized())
|
if (simulatorFsxP3D->isTimeSynchronized())
|
||||||
{
|
{
|
||||||
const int zh = simEnv->zuluTimeSeconds / 3600;
|
const int zh = simEnv->zuluTimeSeconds / 3600;
|
||||||
@@ -321,7 +321,7 @@ namespace BlackSimPlugin
|
|||||||
if (subRequest == CSimConnectDefinitions::SimObjectPositionData)
|
if (subRequest == CSimConnectDefinitions::SimObjectPositionData)
|
||||||
{
|
{
|
||||||
static_assert(sizeof(DataDefinitionPosData) == 5 * sizeof(double), "DataDefinitionRemoteAircraftSimData has an incorrect size.");
|
static_assert(sizeof(DataDefinitionPosData) == 5 * sizeof(double), "DataDefinitionRemoteAircraftSimData has an incorrect size.");
|
||||||
const DataDefinitionPosData *probeSimData = (DataDefinitionPosData *)&pObjData->dwData;
|
const DataDefinitionPosData *probeSimData = reinterpret_cast<const DataDefinitionPosData *>(&pObjData->dwData);
|
||||||
// extra check, but ids should be the same
|
// extra check, but ids should be the same
|
||||||
if (objectId == probeObj.getObjectId())
|
if (objectId == probeObj.getObjectId())
|
||||||
{
|
{
|
||||||
@@ -348,7 +348,7 @@ namespace BlackSimPlugin
|
|||||||
}
|
}
|
||||||
case SIMCONNECT_RECV_ID_AIRPORT_LIST:
|
case SIMCONNECT_RECV_ID_AIRPORT_LIST:
|
||||||
{
|
{
|
||||||
const SIMCONNECT_RECV_AIRPORT_LIST *pAirportList = (SIMCONNECT_RECV_AIRPORT_LIST *) pData;
|
const SIMCONNECT_RECV_AIRPORT_LIST *pAirportList = static_cast<SIMCONNECT_RECV_AIRPORT_LIST *>(pData);
|
||||||
CAirportList simAirports;
|
CAirportList simAirports;
|
||||||
for (unsigned i = 0; i < pAirportList->dwArraySize; ++i)
|
for (unsigned i = 0; i < pAirportList->dwArraySize; ++i)
|
||||||
{
|
{
|
||||||
@@ -371,11 +371,11 @@ namespace BlackSimPlugin
|
|||||||
case SIMCONNECT_RECV_ID_CLIENT_DATA:
|
case SIMCONNECT_RECV_ID_CLIENT_DATA:
|
||||||
{
|
{
|
||||||
if (!simulatorFsxP3D->m_useSbOffsets) { break; }
|
if (!simulatorFsxP3D->m_useSbOffsets) { break; }
|
||||||
const SIMCONNECT_RECV_CLIENT_DATA *clientData = (SIMCONNECT_RECV_CLIENT_DATA *)pData;
|
const SIMCONNECT_RECV_CLIENT_DATA *clientData = static_cast<SIMCONNECT_RECV_CLIENT_DATA *>(pData);
|
||||||
if (simulatorFsxP3D->m_useSbOffsets && clientData->dwRequestID == CSimConnectDefinitions::RequestSbData)
|
if (simulatorFsxP3D->m_useSbOffsets && clientData->dwRequestID == CSimConnectDefinitions::RequestSbData)
|
||||||
{
|
{
|
||||||
//! \fixme FSUIPC vs SimConnect why is offset 19 ident 2/0? In FSUIPC it is 0/1, according to documentation it is 0/1 but I receive 2/0 here. Whoever knows, add comment or fix if wrong
|
//! \fixme FSUIPC vs SimConnect why is offset 19 ident 2/0? In FSUIPC it is 0/1, according to documentation it is 0/1 but I receive 2/0 here. Whoever knows, add comment or fix if wrong
|
||||||
DataDefinitionClientAreaSb *sbData = (DataDefinitionClientAreaSb *) &clientData->dwData;
|
const DataDefinitionClientAreaSb *sbData = reinterpret_cast<const DataDefinitionClientAreaSb *>(&clientData->dwData);
|
||||||
simulatorFsxP3D->updateOwnAircraftFromSimulator(*sbData);
|
simulatorFsxP3D->updateOwnAircraftFromSimulator(*sbData);
|
||||||
}
|
}
|
||||||
break; // SIMCONNECT_RECV_ID_CLIENT_DATA
|
break; // SIMCONNECT_RECV_ID_CLIENT_DATA
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CSimulatorPluginCommon();
|
virtual ~CSimulatorPluginCommon() override;
|
||||||
|
|
||||||
// --------- ISimulator implementations ------------
|
// --------- ISimulator implementations ------------
|
||||||
virtual void unload() override;
|
virtual void unload() override;
|
||||||
|
|||||||
Reference in New Issue
Block a user