mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
refactor(msfs): Use common method to get transponder info
This commit is contained in:
@@ -81,8 +81,7 @@ namespace swift::simplugin::fsxcommon
|
||||
hr += initRemoteAircraftSimDataSet(hSimConnect);
|
||||
hr += initSimulatorEnvironment(hSimConnect);
|
||||
hr += initSbDataArea(hSimConnect);
|
||||
if (simInfo.isMSFS()) { hr += initMSFSTransponder(hSimConnect); }
|
||||
if (simInfo.isMSFS2024()) { hr += initMSFS2024Transponder(hSimConnect); }
|
||||
if (simInfo.isMSFS() || simInfo.isMSFS2024()) { hr += initMSFSTransponder(hSimConnect); }
|
||||
return hr;
|
||||
}
|
||||
|
||||
@@ -423,22 +422,6 @@ namespace swift::simplugin::fsxcommon
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CSimConnectDefinitions::initMSFS2024Transponder(const HANDLE hSimConnect)
|
||||
{
|
||||
HRESULT hr = s_ok();
|
||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataTransponderModeMSFS,
|
||||
"TRANSPONDER STATE:1", "Enum");
|
||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataTransponderModeMSFS,
|
||||
"TRANSPONDER IDENT:1", "Bool");
|
||||
if (isFailure(hr))
|
||||
{
|
||||
CLogMessage(static_cast<CSimConnectDefinitions *>(nullptr))
|
||||
.error(u"SimConnect error: MSFS2024 transponder data definitions %1")
|
||||
<< hr;
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
||||
DataDefinitionRemoteAircraftPartsWithoutLights::DataDefinitionRemoteAircraftPartsWithoutLights()
|
||||
{
|
||||
this->resetToInvalid();
|
||||
|
||||
@@ -345,9 +345,6 @@ namespace swift::simplugin::fsxcommon
|
||||
|
||||
//! Initialize data definition for MSFS transponder
|
||||
static HRESULT initMSFSTransponder(const HANDLE hSimConnect);
|
||||
|
||||
//! Initialize data definition for MSFS transponder
|
||||
static HRESULT initMSFS2024Transponder(const HANDLE hSimConnect);
|
||||
};
|
||||
} // namespace swift::simplugin::fsxcommon
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace swift::simplugin::fsxcommon
|
||||
const QString exceptionString(
|
||||
CSimConnectUtilities::simConnectExceptionToString(static_cast<DWORD>(exception->dwException)));
|
||||
const QString sendIdDetails = simulatorFsxP3D->getSendIdTraceDetails(sendId);
|
||||
CLogMessage(simulatorFsxP3D).warning(u"Caught simConnect exception: '%1' '%2' | send details: '%3'")
|
||||
CLogMessage(simulatorFsxP3D).warning(u"Caught SimConnect exception: '%1' '%2' | send details: '%3'")
|
||||
<< exceptionString << ex << (sendIdDetails.isEmpty() ? "N/A" : sendIdDetails);
|
||||
}
|
||||
break; // SIMCONNECT_RECV_ID_EXCEPTION
|
||||
|
||||
Reference in New Issue
Block a user