mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
Ref T180, formatting / const
This commit is contained in:
@@ -80,7 +80,7 @@ namespace BlackSimPlugin
|
||||
|
||||
// reset flags
|
||||
m_simPaused = false;
|
||||
emitSimulatorCombinedStatus();
|
||||
this->emitSimulatorCombinedStatus();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -138,10 +138,10 @@ namespace BlackSimPlugin
|
||||
bool m_confirmedAdded = false;
|
||||
bool m_pendingRemoved = false;
|
||||
int m_lightsRequestedAt = -1;
|
||||
DataDefinitionRemoteAircraftPartsWithoutLights m_partsAsSent {}; //!< parts as sent
|
||||
BlackMisc::Aviation::CAircraftLights m_currentLightsInSim { nullptr }; //!< current lights to know state for toggling
|
||||
BlackMisc::Aviation::CAircraftLights m_lightsAsSent { nullptr }; //!< lights as sent to simulator
|
||||
SIMCONNECT_PERIOD m_requestSimDataPeriod = SIMCONNECT_PERIOD_NEVER; //!< how often do we query ground elevation
|
||||
DataDefinitionRemoteAircraftPartsWithoutLights m_partsAsSent {}; //!< parts as sent
|
||||
BlackMisc::Aviation::CAircraftLights m_currentLightsInSim { nullptr }; //!< current lights to know state for toggling
|
||||
BlackMisc::Aviation::CAircraftLights m_lightsAsSent { nullptr }; //!< lights as sent to simulator
|
||||
SIMCONNECT_PERIOD m_requestSimDataPeriod = SIMCONNECT_PERIOD_NEVER; //!< how often do we query ground elevation
|
||||
QSharedPointer<BlackMisc::Simulation::CInterpolatorMulti> m_interpolator; //!< shared pointer because CSimConnectObject can be copied
|
||||
};
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace BlackSimPlugin
|
||||
|
||||
CSimulatorFsxCommon::~CSimulatorFsxCommon()
|
||||
{
|
||||
disconnectFrom();
|
||||
this->disconnectFrom();
|
||||
// fsuipc is disconnected in CSimulatorFsCommon
|
||||
}
|
||||
|
||||
@@ -92,8 +92,8 @@ namespace BlackSimPlugin
|
||||
if (m_useFsuipc) { m_fsuipc->connect(); } // FSUIPC too
|
||||
|
||||
// set structures and move on
|
||||
initEvents();
|
||||
initDataDefinitionsWhenConnected();
|
||||
this->initEvents();
|
||||
this->initDataDefinitionsWhenConnected();
|
||||
m_simConnectTimerId = startTimer(DispatchIntervalMs);
|
||||
// do not start m_addPendingAircraftTimer here, it will be started when object was added
|
||||
|
||||
@@ -105,14 +105,14 @@ namespace BlackSimPlugin
|
||||
if (!m_simConnected) { return true; }
|
||||
if (m_simConnectTimerId >= 0) { killTimer(m_simConnectTimerId); }
|
||||
m_simConnectTimerId = -1;
|
||||
this->onSimStopped(); // treat as stopped
|
||||
m_simSimulating = false; // treat as stopped, just setting the flag here avoids overhead of on onSimStopped
|
||||
if (m_hSimConnect)
|
||||
{
|
||||
SimConnect_Close(m_hSimConnect);
|
||||
m_hSimConnect = nullptr;
|
||||
}
|
||||
|
||||
reset();
|
||||
this->reset(); // mark as disconnected and reset all values
|
||||
|
||||
// emit status and disconnect FSUIPC
|
||||
CSimulatorFsCommon::disconnectFrom();
|
||||
@@ -327,15 +327,15 @@ namespace BlackSimPlugin
|
||||
void CSimulatorFsxCommon::onSimStopped()
|
||||
{
|
||||
// stopping events in FSX: Load menu, weather and season
|
||||
const SimulatorStatus oldStatus = getSimulatorStatus();
|
||||
const SimulatorStatus oldStatus = this->getSimulatorStatus();
|
||||
m_simSimulating = false;
|
||||
m_simulatingChangedTs = QDateTime::currentMSecsSinceEpoch();
|
||||
emitSimulatorCombinedStatus(oldStatus);
|
||||
this->emitSimulatorCombinedStatus(oldStatus);
|
||||
}
|
||||
|
||||
void CSimulatorFsxCommon::onSimFrame()
|
||||
{
|
||||
updateRemoteAircraft();
|
||||
this->updateRemoteAircraft();
|
||||
}
|
||||
|
||||
void CSimulatorFsxCommon::onSimExit()
|
||||
@@ -559,7 +559,7 @@ namespace BlackSimPlugin
|
||||
simObject.setConfirmedAdded(true);
|
||||
|
||||
// P3D also has SimConnect_AIReleaseControlEx;
|
||||
const DWORD requestId = obtainRequestIdSimData();
|
||||
const DWORD requestId = this->obtainRequestIdSimData();
|
||||
const DWORD objectId = simObject.getObjectId();
|
||||
HRESULT hr = SimConnect_AIReleaseControl(m_hSimConnect, objectId, static_cast<SIMCONNECT_DATA_REQUEST_ID>(requestId));
|
||||
hr += SimConnect_TransmitClientEvent(m_hSimConnect, objectId, EventFreezeLat, 1,
|
||||
@@ -729,7 +729,7 @@ namespace BlackSimPlugin
|
||||
void CSimulatorFsxCommon::timerEvent(QTimerEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
dispatch();
|
||||
this->dispatch();
|
||||
}
|
||||
|
||||
const QString &CSimulatorFsxCommon::modeToString(CSimulatorFsxCommon::AircraftAddMode mode)
|
||||
@@ -841,8 +841,8 @@ namespace BlackSimPlugin
|
||||
const CAircraftModel aircraftModel = newRemoteAircraft.getModel();
|
||||
CSimulatedAircraft addedAircraft(newRemoteAircraft);
|
||||
|
||||
const DWORD requestId = obtainRequestIdSimData();
|
||||
SIMCONNECT_DATA_INITPOSITION initialPosition = aircraftSituationToFsxPosition(addedAircraft.getSituation());
|
||||
const DWORD requestId = this->obtainRequestIdSimData();
|
||||
const SIMCONNECT_DATA_INITPOSITION initialPosition = aircraftSituationToFsxPosition(addedAircraft.getSituation());
|
||||
const QString modelString(addedAircraft.getModelString());
|
||||
if (this->showDebugLogMessage()) { this->debugLogMessage(Q_FUNC_INFO, QString("Cs: '%1' model: '%2' request: %3, init pos: %4").arg(callsign.toQString(), modelString).arg(requestId).arg(fsxPositionToString(initialPosition))); }
|
||||
|
||||
@@ -851,7 +851,7 @@ namespace BlackSimPlugin
|
||||
{
|
||||
const CStatusMessage msg = CStatusMessage(this).error("SimConnect, can not create AI traffic: '%1' '%2'") << callsign.toQString() << aircraftModel.getModelString();
|
||||
CLogMessage::preformatted(msg);
|
||||
emit physicallyAddingRemoteModelFailed(addedAircraft, msg);
|
||||
emit this->physicallyAddingRemoteModelFailed(addedAircraft, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1424,7 +1424,7 @@ namespace BlackSimPlugin
|
||||
m_requestIdSimData = RequestSimDataStart;
|
||||
m_dispatchErrors = 0;
|
||||
m_receiveExceptionCount = 0;
|
||||
CSimulatorFsCommon::reset();
|
||||
CSimulatorFsCommon::reset(); // clears all pending aircraft etc
|
||||
}
|
||||
|
||||
void CSimulatorFsxCommon::clearAllAircraft()
|
||||
|
||||
@@ -55,16 +55,16 @@ namespace BlackSimPlugin
|
||||
const DWORD sendId = exception->dwSendID;
|
||||
const DWORD index = exception->dwIndex;
|
||||
const DWORD data = cbData;
|
||||
const QString exStr(CSimConnectUtilities::simConnectExceptionToString((SIMCONNECT_EXCEPTION)exception->dwException));
|
||||
QString ex;
|
||||
ex.sprintf("Exception=%lu | SendID=%lu | Index=%lu | cbData=%lu", exceptionId, sendId, index, data);
|
||||
switch (exceptionId)
|
||||
{
|
||||
case SIMCONNECT_EXCEPTION_OPERATION_INVALID_FOR_OBJECT_TYPE: break;
|
||||
case SIMCONNECT_EXCEPTION_UNRECOGNIZED_ID: break;
|
||||
default: break;
|
||||
}
|
||||
CLogMessage(simulatorFsx).warning("Caught FSX simConnect exception: %1 %2") << exStr << ex;
|
||||
QString ex;
|
||||
ex.sprintf("Exception=%lu | SendID=%lu | Index=%lu | cbData=%lu", exceptionId, sendId, index, data);
|
||||
const QString exStr(CSimConnectUtilities::simConnectExceptionToString((SIMCONNECT_EXCEPTION)exception->dwException));
|
||||
CLogMessage(simulatorFsx).warning("Caught simConnect exception: %1 %2") << exStr << ex;
|
||||
break;
|
||||
}
|
||||
case SIMCONNECT_RECV_ID_QUIT:
|
||||
@@ -74,7 +74,7 @@ namespace BlackSimPlugin
|
||||
}
|
||||
case SIMCONNECT_RECV_ID_EVENT:
|
||||
{
|
||||
SIMCONNECT_RECV_EVENT *event = static_cast<SIMCONNECT_RECV_EVENT *>(pData);
|
||||
const SIMCONNECT_RECV_EVENT *event = static_cast<SIMCONNECT_RECV_EVENT *>(pData);
|
||||
switch (event->uEventID)
|
||||
{
|
||||
case SystemEventSimStatus:
|
||||
@@ -117,7 +117,7 @@ namespace BlackSimPlugin
|
||||
|
||||
// such an object is not necessarily one of ours
|
||||
// for instance, I always see object "5" when I start the simulator
|
||||
if (!simulatorFsx->getSimConnectObjects().isKnownSimObjectId(objectId)) break;
|
||||
if (!simulatorFsx->getSimConnectObjects().isKnownSimObjectId(objectId)) { break; }
|
||||
switch (event->uEventID)
|
||||
{
|
||||
case SystemEventObjectAdded:
|
||||
@@ -133,7 +133,7 @@ namespace BlackSimPlugin
|
||||
}
|
||||
case SIMCONNECT_RECV_ID_EVENT_FRAME:
|
||||
{
|
||||
SIMCONNECT_RECV_EVENT_FRAME *event = (SIMCONNECT_RECV_EVENT_FRAME *) pData;
|
||||
const SIMCONNECT_RECV_EVENT_FRAME *event = (SIMCONNECT_RECV_EVENT_FRAME *) pData;
|
||||
switch (event->uEventID)
|
||||
{
|
||||
case SystemEventFrame:
|
||||
@@ -147,7 +147,7 @@ namespace BlackSimPlugin
|
||||
}
|
||||
case SIMCONNECT_RECV_ID_ASSIGNED_OBJECT_ID:
|
||||
{
|
||||
SIMCONNECT_RECV_ASSIGNED_OBJECT_ID *event = static_cast<SIMCONNECT_RECV_ASSIGNED_OBJECT_ID *>(pData);
|
||||
const SIMCONNECT_RECV_ASSIGNED_OBJECT_ID *event = static_cast<SIMCONNECT_RECV_ASSIGNED_OBJECT_ID *>(pData);
|
||||
const DWORD requestId = event->dwRequestID;
|
||||
const DWORD objectId = event->dwObjectID;
|
||||
bool success = simulatorFsx->setSimConnectObjectId(requestId, objectId);
|
||||
@@ -170,7 +170,7 @@ namespace BlackSimPlugin
|
||||
}
|
||||
case SIMCONNECT_RECV_ID_SIMOBJECT_DATA:
|
||||
{
|
||||
SIMCONNECT_RECV_SIMOBJECT_DATA *pObjData = (SIMCONNECT_RECV_SIMOBJECT_DATA *) pData;
|
||||
const SIMCONNECT_RECV_SIMOBJECT_DATA *pObjData = (SIMCONNECT_RECV_SIMOBJECT_DATA *) pData;
|
||||
const DWORD requestId = pObjData->dwRequestID;
|
||||
switch (requestId)
|
||||
{
|
||||
@@ -249,10 +249,10 @@ namespace BlackSimPlugin
|
||||
{
|
||||
static const CLength maxDistance(200.0, CLengthUnit::NM());
|
||||
const CCoordinateGeodetic posAircraft(simulatorFsx->getOwnAircraftPosition());
|
||||
SIMCONNECT_RECV_AIRPORT_LIST *pAirportList = (SIMCONNECT_RECV_AIRPORT_LIST *) pData;
|
||||
const SIMCONNECT_RECV_AIRPORT_LIST *pAirportList = (SIMCONNECT_RECV_AIRPORT_LIST *) pData;
|
||||
for (unsigned i = 0; i < pAirportList->dwArraySize; ++i)
|
||||
{
|
||||
SIMCONNECT_DATA_FACILITY_AIRPORT *pFacilityAirport = pAirportList->rgData + i;
|
||||
const SIMCONNECT_DATA_FACILITY_AIRPORT *pFacilityAirport = pAirportList->rgData + i;
|
||||
if (!pFacilityAirport) { break; }
|
||||
const QString icao(pFacilityAirport->Icao);
|
||||
if (icao.isEmpty()) { continue; } // airfield without ICAO code
|
||||
@@ -276,7 +276,7 @@ namespace BlackSimPlugin
|
||||
case SIMCONNECT_RECV_ID_CLIENT_DATA:
|
||||
{
|
||||
if (!simulatorFsx->m_useSbOffsets) { break; }
|
||||
SIMCONNECT_RECV_CLIENT_DATA *clientData = (SIMCONNECT_RECV_CLIENT_DATA *)pData;
|
||||
const SIMCONNECT_RECV_CLIENT_DATA *clientData = (SIMCONNECT_RECV_CLIENT_DATA *)pData;
|
||||
if (simulatorFsx->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
|
||||
@@ -287,7 +287,7 @@ namespace BlackSimPlugin
|
||||
}
|
||||
case SIMCONNECT_RECV_ID_EVENT_FILENAME:
|
||||
{
|
||||
SIMCONNECT_RECV_EVENT_FILENAME *event = static_cast<SIMCONNECT_RECV_EVENT_FILENAME *>(pData);
|
||||
const SIMCONNECT_RECV_EVENT_FILENAME *event = static_cast<SIMCONNECT_RECV_EVENT_FILENAME *>(pData);
|
||||
switch (event->uEventID)
|
||||
{
|
||||
case SystemEventFlightLoaded: break;
|
||||
|
||||
Reference in New Issue
Block a user